[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]


Robert Locke wrote:
> Because the upstream kernel decision was to use 4KSTACKS.  You need to
> take that up with Linus.... :-)  Feel free to search the lkml archives,
> for a technical discussion on the merits of 4K vs. larger, but the short
> answer is that those technical folks like 4K better (I seem to recall
> something to the effect of big stack equals sloppy coding)....

On PowerPC, x86, and x86_64, physical memory (and swap-space) is divided
into 4K pages[1][2], and allocated and managed as 4K pages.

For normal programs, the kernel and the Memory Management Unit(s) in the
processor(s) can concatenate these pages in whatever order necessary so
it "looks" to the program as though it has a seamless allocation of

This doesn't work for the kernel. If the kernel wants 8K of memory in
one "lump", it needs to find two free 4K pages that are together in

This turns out to be a problem -- after the computer has been running
for a while, there may not be any adjacent pages available. Each process
needs its own stack, so this can mean that it's not possible to start
any more processes. Many Unix programs rely on being able to start new
processes easily, so this can be a big problem.


Hope this helps,

[1] Usually -- occasionally 2MB, 4MB or 1 GB pages are used...
[2] Other architectures may have different size stacks -- I believe
Alpha has 8K, and the old VAX had 512 bytes.
E-mail:     james@ | In the Royal Air Force a landing's OK,
aprilcottage.co.uk | If the pilot gets out and can still walk away.
                   | But in the Fleet Air Arm the outlook is grim,
                   | If your landings are duff and you've not learnt to swim.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]