Subject: 'growable' mmap regions
To: None <email@example.com>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
Date: 08/28/2004 00:59:16
Linux has concept of 'growable' mmap region. This is used for thread
stack memory - memory is allocated using mmap(2) with special flag
and passed as stack for a new thread via clone(2). Then the memory
block is automatically extended when the page fault happens below
the currently-mapped memory block, up to the per-thread stack size
I'm thinking of a good way to emulate this. Do we want to be able
to have stack-like memory segments like this? Currently the page
fault code handling growing of stack hardcodes check against USRSTACK, so
it's limited only to the (single) stack allocated on process execution.
I'm not really convinced this is very useful when using virtual memory
management - such scheme doesn't preserve VA space (since the space must
be reserved for the stack grow anyway), and physical pages are
allocated on-demand, so bigger memory piece doesn't waste more physical RAM
than the small one (with overcommit, at least).
What do other think? Would this be useful as generic feature?
If not, I'll resort to some kind of hack, so that Linux binary
apps using this would run properly under NetBSD linux emulation.
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the Buddhist -=-
-=- masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-