* How to reserve address space without actual backing store
@ 2008-02-24 12:05 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2008-02-24 12:05 UTC (permalink / raw)
To: linux-mm
This is more or less a userspace API question, but the documentation
I've found in manpages does not match actual kernel behavior, so I'm
asking here.
With vm.overcommit_memory and address space randomization, a lot of
applications (particularly those who use certain types of garbage
collectors) need a way to reserve a chunk of the address space, without
actually counting towards the vm.overcommit_memory limit. Typically,
you want to allocate all the heap in a single, continuous range. As the
heap usage increases, you gradually allocate backing store from the
kernel. (Without address space randomization, you can use some
heuristics to avoid DSO space etc. and use MAP_FIXED to grow the heap as
needed, I suppose.)
MAP_NORESERVE does not work for this purpose because memory allocated
that way still counts as comitted. What seems to work is to reserve
address space with PROT_NONE, and later use mprotected to get backing
store. My question is if this is an accident, or if this approach is
guaranteed to work in the future.
(mprotect to subsequently add PROT_EXEC has been broken on some
architectures unless you take special measures, so I guess that this is
genuine concern.)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-24 12:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 12:05 How to reserve address space without actual backing store Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).