From f7e9143bb16f6cbf208830ce5eaf4a854c27af74 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 23 Aug 2004 21:11:26 -0700 Subject: [PATCH] [PATCH] sched: self-reaping atomicity fix 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/exit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/exit.c b/kernel/exit.c index 483f7871c9026..b21436b147f14 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -781,8 +782,14 @@ static void exit_notify(struct task_struct *tsk) /* 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(); -- 2.53.0