aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2010-05-26 17:43:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:45 -0400
commit9c3391684415c9dca239130d9e433a60a4edf04b (patch)
treea8019b964c625cfeeda0e9d85bafa48991546212 /kernel/exit.c
parent269b005a28e124a341df4adef2c3661cf7371fcc (diff)
exit: exit_notify() can trust signal->notify_count < 0
signal_struct->count in its current form must die. - it has no reasons to be atomic_t - it looks like a reference counter, but it is not - otoh, we really need to make task->signal refcountable, just look at the extremely ugly task_rq_unlock_wait() called from __exit_signals(). - we should change the lifetime rules for task->signal, it should be pinned to task_struct. We have a lot of code which can be simplified after that. - it is not needed! while the code is correct, any usage of this counter is artificial, except fs/proc uses it correctly to show the number of threads. This series removes the usage of sig->count from exit pathes. This patch: Now that Veaceslav changed copy_signal() to use zalloc(), exit_notify() can just check notify_count < 0 to ensure the execing sub-threads needs the notification from us. No need to do other checks, notify_count != 0 must always mean ->group_exit_task != NULL is waiting for us. 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.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 019a2843bf95..59a104c673f7 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -856,12 +856,9 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
856 856
857 tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE; 857 tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE;
858 858
859 /* mt-exec, de_thread() is waiting for us */ 859 /* mt-exec, de_thread() is waiting for group leader */
860 if (thread_group_leader(tsk) && 860 if (unlikely(tsk->signal->notify_count < 0))
861 tsk->signal->group_exit_task &&
862 tsk->signal->notify_count < 0)
863 wake_up_process(tsk->signal->group_exit_task); 861 wake_up_process(tsk->signal->group_exit_task);
864
865 write_unlock_irq(&tasklist_lock); 862 write_unlock_irq(&tasklist_lock);
866 863
867 tracehook_report_death(tsk, signal, cookie, group_dead); 864 tracehook_report_death(tsk, signal, cookie, group_dead);