Address space: what's safe?
Steve.Blackburn at anu.edu.au
Fri Mar 7 11:06:55 EST 2003
Thank you all for the feedback so far.
I need to clarify. I don't pretend to be a linux expert, so your
patience is appreciated...
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).
2. No, we're not using unmapped space.
3. Yes, the kernel does not distinguish between stuff mapped for
libraries, and that mapped for/by the user. This is the problem.
4. Yes, I have seen this problem. Speaking with Bill Clarke, it
seems that what has happend is that my fixed mmaps are causing
libraries to be unmapped with obviously nasty consequences---hence
I change the range I mapped more or less by trial and error. The
latter is the process I want to avoid/automate. Implicit in
Bill's feedback is that the libraries are not mmapped fixed, so if
I nailed down my space before they were loaded, then clashes might
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
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.
Any further thoughts or insights appreciated.
More information about the linux