Re: Question regarding thread_struct

From: Robert Love
Date: Tue Mar 08 2005 - 12:36:55 EST


On Tue, 2005-03-08 at 22:57 +0530, Imanpreet Arora wrote:

> This has been a doubt for a couple of days, and I am wondering if this
> one could also be cleared. When you say kernel stack, can't be resized
>
>
> a) Does it mean that the _whole_ of the kernel is restricted to
> that 8K or 16K of memory?

Actually, 4K or 8K these days for x86. But, no, it means that EACH
PROCESS is constrained to the kernel stack. The stacks are per-process.
The kernel never "runs on its own" -- it is always in the context of a
process (which has its own kernel stack) or an interrupt handler (which
either shares the previous process's stack or has its own stack,
depending on CONFIG_IRQSTACKS).

> b) Or does it mean that a particular stack for a particular
> process, can't be resized?

Yes, I just said that in the previous email. The kernel stack cannot be
resized. It is fixed. It is one or two pages, depending on configure
option. That is, 4 or 8K.

The _user-space_ stack, what the application actually uses, is
dynamically resizable. But we are not talking about that.

> c) And for that matter how exactly do we define a kernel stack?

I don't know what you mean. alloc_thread_info() creates the thread_info
structure and stack.

Robert Love


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/