Address space: what's safe?

Martin Pool mbp at samba.org
Fri Mar 7 12:39:25 EST 2003


On  7 Mar 2003, Steve Blackburn <Steve.Blackburn at anu.edu.au> wrote:

> 1.  The system in question is the memory management system for a
>     virtual machine.  We want as much virtual memory to play with as
>     possible, and certain GC algorithms have strong constraints about
>     the contiguity and alignment of memory (for example address-order
>     write barriers are fast because they rely on different regions
>     sitting either side of major address boundaries and the nursery,
>     say, is in the high address range).  So, in short, yes, I do need
>     this level of control, and something like posix_memalign is not
>     going to cut it.  No, I'm not speculating, I'm talking about a
>     real system that I've worked on for a number of years (Jikes RVM).

Sorry, I don't understand why you say memalign won't cut it.  Can you
give an example?

> 5.  Basically, I want to know (preferably ahead of time so constants
>     can be compiled in) is: What is the largest contigious range of
>     virtual memory linux will let, and where is it in the address
>     space?

Well, I would say: on x86, just mmap say 1GB or 512MB, without
specifying a fixed address.  This should allow plenty of room for
code, libraries, heap, and stack, and be as large as people would
probably want on that architecture.  Perhaps provide a command-line
parameter that sets the size so people with very large programs can be
bigger and take their chances.

> 6.  Between Bill & Martijn, the following solution makes a good start:
>       . find the biggest chunk of available vm by mmaping increasingly
>         large unreserved areas until they fail.
>       . use the above to mmap a fixed region of the appropriate
>         size.

This is not so good because you might allocate so much VM that there
was no space to mmap other necessary things in the future, such as
dynamic libraries loaded by JNI, or data files that are mmaped.

-- 
Martin 


More information about the linux mailing list