From: Oleg Nesterov Date: Wed, 10 Dec 2014 23:55:23 +0000 (-0800) Subject: exit: exit_notify: re-use "dead" list to autoreap current X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=6c66e7dba3d4419c8b973505679635efcd6b311c;p=openwrt%2Fstaging%2Fblogic.git exit: exit_notify: re-use "dead" list to autoreap current After the previous change we can add just the exiting EXIT_DEAD task to the "dead" list and remove another release_task(tsk). Signed-off-by: Oleg Nesterov Cc: Aaron Tomlin Cc: "Eric W. Biederman" Cc: Sterling Alexander Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/exit.c b/kernel/exit.c index 8061891ddd9b..8714e5ded8b4 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -632,6 +632,8 @@ static void exit_notify(struct task_struct *tsk, int group_dead) } tsk->exit_state = autoreap ? EXIT_DEAD : EXIT_ZOMBIE; + if (tsk->exit_state == EXIT_DEAD) + list_add(&tsk->ptrace_entry, &dead); /* mt-exec, de_thread() is waiting for group leader */ if (unlikely(tsk->signal->notify_count < 0)) @@ -642,10 +644,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead) list_del_init(&p->ptrace_entry); release_task(p); } - - /* If the process is dead, release it - nobody will wait for it */ - if (autoreap) - release_task(tsk); } #ifdef CONFIG_DEBUG_STACK_USAGE