exit: avoid sig->count in de_thread/__exit_signal synchronization
de_thread() and __exit_signal() use signal_struct->count/notify_count for synchronization. We can simplify the code and use ->notify_count only. Instead of comparing these two counters, we can change de_thread() to set ->notify_count = nr_of_sub_threads, then change __exit_signal() to dec-and-test this counter and notify group_exit_task. Note that __exit_signal() checks "notify_count > 0" just for symmetry with exit_notify(), we could just check it is != 0. 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
09faef11df
commit
d344193a05
2 changed files with 7 additions and 8 deletions
|
@ -97,7 +97,7 @@ static void __exit_signal(struct task_struct *tsk)
|
|||
* If there is any task waiting for the group exit
|
||||
* then notify it:
|
||||
*/
|
||||
if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count)
|
||||
if (sig->notify_count > 0 && !--sig->notify_count)
|
||||
wake_up_process(sig->group_exit_task);
|
||||
|
||||
if (tsk == sig->curr_target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue