forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
269b005a28
commit
9c33916844
|
@ -856,12 +856,9 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
|
||||||
|
|
||||||
tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE;
|
tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE;
|
||||||
|
|
||||||
/* mt-exec, de_thread() is waiting for us */
|
/* mt-exec, de_thread() is waiting for group leader */
|
||||||
if (thread_group_leader(tsk) &&
|
if (unlikely(tsk->signal->notify_count < 0))
|
||||||
tsk->signal->group_exit_task &&
|
|
||||||
tsk->signal->notify_count < 0)
|
|
||||||
wake_up_process(tsk->signal->group_exit_task);
|
wake_up_process(tsk->signal->group_exit_task);
|
||||||
|
|
||||||
write_unlock_irq(&tasklist_lock);
|
write_unlock_irq(&tasklist_lock);
|
||||||
|
|
||||||
tracehook_report_death(tsk, signal, cookie, group_dead);
|
tracehook_report_death(tsk, signal, cookie, group_dead);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user