Skip to content

Commit b3ab031

Browse files
oleg-nesterovtorvalds
authored andcommitted
wait: completely ignore the EXIT_DEAD tasks
Now that EXIT_DEAD is the terminal state it doesn't make sense to call eligible_child() or security_task_wait() if the task is really dead. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Tested-by: Michal Schmidt <mschmidt@redhat.com> Cc: Jan Kratochvil <jan.kratochvil@redhat.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Lennart Poettering <lpoetter@redhat.com> Cc: Roland McGrath <roland@hack.frob.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b436069 commit b3ab031

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

kernel/exit.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,12 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
13291329
static int wait_consider_task(struct wait_opts *wo, int ptrace,
13301330
struct task_struct *p)
13311331
{
1332-
int ret = eligible_child(wo, p);
1332+
int ret;
1333+
1334+
if (unlikely(p->exit_state == EXIT_DEAD))
1335+
return 0;
1336+
1337+
ret = eligible_child(wo, p);
13331338
if (!ret)
13341339
return ret;
13351340

@@ -1347,10 +1352,6 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace,
13471352
return 0;
13481353
}
13491354

1350-
/* dead body doesn't have much to contribute */
1351-
if (unlikely(p->exit_state == EXIT_DEAD))
1352-
return 0;
1353-
13541355
if (unlikely(p->exit_state == EXIT_TRACE)) {
13551356
/*
13561357
* ptrace == 0 means we are the natural parent. In this case

0 commit comments

Comments
 (0)