Skip to content

Commit 0976a03

Browse files
committed
reparent_leader: check EXIT_DEAD instead of task_detached()
Change reparent_leader() to check ->exit_state instead of ->exit_signal, this matches the similar EXIT_DEAD check in wait_consider_task() and allows us to cleanup the do_notify_parent/task_detached logic. task_detached() was really needed during reparenting before 9cd80bb "do_wait() optimization: do not place sub-threads on ->children list" to filter out the sub-threads. After this change task_detached(p) can only be true if p is the dead group_leader and its parent ignores SIGCHLD, in this case the caller of do_notify_parent() is going to reap this task and it should set EXIT_DEAD. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Tejun Heo <tj@kernel.org>
1 parent 8677347 commit 0976a03

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/exit.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
742742
{
743743
list_move_tail(&p->sibling, &p->real_parent->children);
744744

745-
if (task_detached(p))
745+
if (p->exit_state == EXIT_DEAD)
746746
return;
747747
/*
748748
* If this is a threaded reparent there is no need to

0 commit comments

Comments
 (0)