From: Ingo Molnar <mingo@elte.hu> disable preemption in the self-reap codepath, as such tasks may not be on the tasklist anymore and CPU-hotplug relies on the tasklist to migrate tasks. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> --- 25-akpm/kernel/exit.c | 7 +++++++ 1 files changed, 7 insertions(+) diff -puN kernel/exit.c~sched-self-reap-fix kernel/exit.c --- 25/kernel/exit.c~sched-self-reap-fix 2004-08-20 02:04:27.375584976 -0700 +++ 25-akpm/kernel/exit.c 2004-08-20 02:04:27.382583912 -0700 @@ -24,6 +24,7 @@ #include <linux/proc_fs.h> #include <linux/mempolicy.h> #include <linux/perfctr.h> +#include <linux/cpu.h> #include <asm/uaccess.h> #include <asm/unistd.h> @@ -783,8 +784,14 @@ static void exit_notify(struct task_stru /* If the process is dead, release it - nobody will wait for it */ if (state == TASK_DEAD) { + lock_cpu_hotplug(); release_task(tsk); write_lock_irq(&tasklist_lock); + /* + * No preemption may happen from this point on, + * or CPU hotplug (and task exit) breaks: + */ + unlock_cpu_hotplug(); tsk->state = state; _raw_write_unlock(&tasklist_lock); local_irq_enable(); _