Re: [PATCH][RFC] 4K stacks default, not a debug thing any more...?

Phillip Susi
2007-07-18T17:19:53Z

Matt Mackall wrote:
>> As far as I'm aware, the actual reason for 4K stacks is that after the
>> system has been up and running for some time getting "1 physically
>> contiguous pages" becomes significantly easier than 2 which wouldn't be
>> arbitrary.
>
> If there are exactly two free pages in the system, the odds of them
> being buddies (ie adjacent AND properly aligned) is quite small. The
> available page pool has to grow quite a bit before the availability of
> order-1 page pairs approaches 100%.
>
> So if we fail to allocate an 8k stack when we could have allocated a
> 4k stack, we're almost certainly failing significantly prematurely.

Why do the two pages have to be physically contiguous? The stack just
needs to be two contiguous pages in virtual memory, but they can map to
any two pages anywhere in physical memory.