LWN.net Logo

4K stacks by default?

4K stacks by default?

Posted Apr 25, 2008 21:31 UTC (Fri) by giraffedata (subscriber, #1954)
In reply to: 4K stacks by default? by scarabaeus
Parent article: 4K stacks by default?

Why does the stack have to be in contiguous memory - is it addressed via its physical address?

Contiguous virtual memory. That's what I meant by the address space being the scarce resource. We can afford to allocate 4K of virtual addresses when the process is created, but we can't afford to allocate 8K of them even if the 2nd 4K aren't mapped to physical memory until needed.

With a different memory layout, Linux might not have that problem. Some OSes put the kernel stack in a separate address space for each process. But Linux puts all of the kernel memory, including every process' stack, in all the address spaces. So even if the kernel were pageable, there would still be a virtual address allocation problem.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds