diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-05-26 17:43:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:46 -0400 |
commit | 4a5999429739844367d0f77a65efdd7db8202779 (patch) | |
tree | fff1158fa43466b30294a7db2c4629ca14973770 /kernel/exit.c | |
parent | d344193a05da89c97e965da2c5cbf687d7385eae (diff) |
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 <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 5 |
1 files 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) | |||
88 | rcu_read_lock_held() || | 88 | rcu_read_lock_held() || |
89 | lockdep_tasklist_lock_is_held()); | 89 | lockdep_tasklist_lock_is_held()); |
90 | spin_lock(&sighand->siglock); | 90 | spin_lock(&sighand->siglock); |
91 | atomic_dec(&sig->count); | ||
91 | 92 | ||
92 | posix_cpu_timers_exit(tsk); | 93 | posix_cpu_timers_exit(tsk); |
93 | if (atomic_dec_and_test(&sig->count)) | 94 | if (thread_group_leader(tsk)) { |
94 | posix_cpu_timers_exit_group(tsk); | 95 | posix_cpu_timers_exit_group(tsk); |
95 | else { | 96 | } else { |
96 | /* | 97 | /* |
97 | * If there is any task waiting for the group exit | 98 | * If there is any task waiting for the group exit |
98 | * then notify it: | 99 | * then notify it: |