I know Linux kernel take thread kernel stack as ISR stack before 2.6.32, after 2.6.32, kernel uses separated stack, if wrong, please correct me. Would you tell me when the ISR stack is setup/crated, or destroy if there is. Or tell me the source file name and line number? Thanks in advance.
Updated at Oct 17 2014:
There are several kinds of stack in Linux. Below are 3 major(not all) that I know.
- User space process stack, each user space task has its own stack, this is created by mmap() when task is created.
- Kernel stack for user space task, one for each user space task, this is created within do_fork()->copy_process()->dup_task_struct()->alloc_thread_info() and used for system_call.
- Stack for hardware interruption(top half), one for each CPU(after 2.6),
defined in arch/x86/kernel/irq_32.c:
DEFINE_PER_CPU(struct irq_stack *, hardirq_stack);
do_IRQ() -> handle_irq() -> execute_on_irq_stack() switch the interrupt stack
Please let me know if these are correct or not.