From 4a5999429739844367d0f77a65efdd7db8202779 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 26 May 2010 14:43:12 -0700 Subject: exit: avoid sig->count in __exit_signal() to detect the group-dead case Change __exit_signal() to check thread_group_leader() instead of atomic_dec_and_test(&sig->count). This must be equivalent, the group leader must be released only after all other threads have exited and passed __exit_signal(). Henceforth sig->count is not actually used, except in fs/proc for get_nr_threads/etc. Signed-off-by: Oleg Nesterov Acked-by: Roland McGrath Cc: Veaceslav Falico Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/exit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index 9220967f4256..4c70c377d21f 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -88,11 +88,12 @@ static void __exit_signal(struct task_struct *tsk) rcu_read_lock_held() || lockdep_tasklist_lock_is_held()); spin_lock(&sighand->siglock); + atomic_dec(&sig->count); posix_cpu_timers_exit(tsk); - if (atomic_dec_and_test(&sig->count)) + if (thread_group_leader(tsk)) { posix_cpu_timers_exit_group(tsk); - else { + } else { /* * If there is any task waiting for the group exit * then notify it: -- cgit v1.2.2