Re: top stack (l)users for 2.5.69

Richard B. Johnson
2003-05-07T18:13:40Z

On Wed, 7 May 2003, Roland Dreier wrote:

> Richard> The kernel stack, at least for ix86, is only one, set
> Richard> upon startup at 8192 bytes above a label called
> Richard> init_task_unit. The kernel must have a separate stack
> Richard> and, contrary to what I've been reading on this list, it
> Richard> can't have more kernel stacks than CPUs and, I don't see
> Richard> a separate stack allocated for different CPUs.
>
> This is total nonsense. Please don't confuse matters by spreading
> misinformation like this. Every task has a separate (8K) kernel
> stack. Look at the implementation of do_fork() and in particular
> alloc_task_struct().
>
> If there were only one kernel stack, what do you think would happen if
> a process went to sleep in kernel code?
>
> - Roland
>

No, No. That is a process stack. Every process has it's own, entirely
seperate stack. This stack is used only in user mode. The kernel has
it's own stack. Every time you switch to kernel mode either by
calling the kernel or by a hardware interrupt, the kernel's stack
is used.

When a task sleeps, it sleeps in kernel mode. The kernel schedules
other tasks until the sleeper has been satisfied either by time or
by event.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.