mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
exec: RT sub-thread can livelock and monopolize CPU on exec
de_thread() yields waiting for ->group_leader to be a zombie. This deadlocks if an rt-prio execer shares the same cpu with ->group_leader. Change the code to use ->group_exit_task/notify_count mechanics. This patch certainly uglifies the code, perhaps someone can suggest something better. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Roland McGrath <roland@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
356d6d5058
commit
6db840fa78
2 changed files with 22 additions and 16 deletions
|
@ -92,10 +92,9 @@ 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->group_exit_task && atomic_read(&sig->count) == sig->notify_count)
|
||||
wake_up_process(sig->group_exit_task);
|
||||
sig->group_exit_task = NULL;
|
||||
}
|
||||
|
||||
if (tsk == sig->curr_target)
|
||||
sig->curr_target = next_thread(tsk);
|
||||
/*
|
||||
|
@ -827,6 +826,11 @@ static void exit_notify(struct task_struct *tsk)
|
|||
state = EXIT_DEAD;
|
||||
tsk->exit_state = state;
|
||||
|
||||
if (thread_group_leader(tsk) &&
|
||||
tsk->signal->notify_count < 0 &&
|
||||
tsk->signal->group_exit_task)
|
||||
wake_up_process(tsk->signal->group_exit_task);
|
||||
|
||||
write_unlock_irq(&tasklist_lock);
|
||||
|
||||
list_for_each_safe(_p, _n, &ptrace_dead) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue