I don't think this is quite accurate either. I have been reading this
thread, and putting that together with what makes sense to me, I gather
that Linux uses the following stacks:
1) A variable sized user-space stack, one per process (maybe more for
user-level threads?). This is swappable.
2) One 8K kernel stack for each process. This is used for situations
such as when a user process makes a system call that then needs to use a
stack. This has to be separate from the user stack for two reasons:
(a) If the user process borked the user stack pointer, the kernel
still needs to have something valid.
(b) The stack used by the kernel cannot be swappable.
3) One single interrupt stack for hardware interrupts. I don't know how
various CPU's deal with this, so either the CPU knows to use this for
hardware interrupts, or the hardware interrupt starts using the current
process's kernel stack then realizes this and switches over.
At the moment, I'm assuming that when the kernel is preempted, the stack
switched to is one which is the kernel stack for some other process.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/