[KLUG Members] more 2.6 goodness

somercet at core.com somercet at core.com
Thu Jun 17 23:51:47 EDT 2004


Having read a bit about 4K kernel stacks, I decided to try it out. It
resides under Kernel Hacking in the Linux config menus.

I've also disabled CONFIG_PREEMPT.

Why a 4K stack? The kernel stacks must be allocated as a contiguous
piece of memory for each process and thread instance -- on x86 hardware,
the MMU uses 4KB pages as the base unit. This stack is used whenever
system calls (kernel calls) or interrupts are invoked. The kernel
standard on most architectures was 8K, or two pages of RAM.

Unfortunately, even in a 256MB machine, the longer you run, the more
fragmentation of memory space you have, making the vm juggle pages when
some process executes a fork(). Some kernel hackers on i386/x86-64 have
seen the vm kick around 20MB of memory to get 2 adjacent pages freed.

This does not affect the user stack. Only some parts of the kernel are
vulnerable  to stack overflow. Also, you have to track your binary
modules: 8K modules won't work on a 4K kernel.

http://lwn.net/Articles/83794/

"I recall an old joke that the sorriest man alive was the one who
decided the S/360 didn't need a stack." -- Jim Keohane

And I've disabled CONFIG_PREEMPT. I started using this as a 2.4.x patch
because it made XMMS bulletproof. It used the SMP capabilities to allow
most kernel code to be preemptively multitasked.

But time marches on. Con Kolivas' interactivity scheduler patches now
run in a kernel with MUCH lower latencies. XMMS is unshakeable no matter
what else I do in X. (X is run *without* using nice(1) to bump the
priority.)

-- 
"All weakness tends to corrupt; impotence
corrupts absolutely." -- Spalding Gray


More information about the Members mailing list