aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-12-10 18:55:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:17 -0500
commit3750ef979cfa1296630aa9f23e265c1bd721498a (patch)
treeec0da6a3d2c2ee8b989e0826817a4c5ea45b4627 /kernel/exit.c
parent7d24e2df52f596a1ea922e4f84a61f2fb24fbb70 (diff)
exit: reparent: s/while_each_thread/for_each_thread/ in find_new_reaper()
Change find_new_reaper() to use for_each_thread() instead of deprecated while_each_thread(). We do not bother to check "thread != father" in the 1st loop, we can rely on PF_EXITING check. Note: this means the minor behavioural change: for_each_thread() starts from the group leader. But this should be fine, nobody should make any assumption about do_wait(__WNOTHREAD) when it comes to reparented tasks. And this can avoid the pointless reparenting to a short-living thread While zombie leaders are not that common. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Aaron Tomlin <atomlin@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Lennart Poettering <lennart@poettering.net> Cc: Sterling Alexander <stalexan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 9babd47a36e2..a4204aaba8a2 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -473,8 +473,7 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
473 struct pid_namespace *pid_ns = task_active_pid_ns(father); 473 struct pid_namespace *pid_ns = task_active_pid_ns(father);
474 struct task_struct *thread; 474 struct task_struct *thread;
475 475
476 thread = father; 476 for_each_thread(father, thread) {
477 while_each_thread(father, thread) {
478 if (thread->flags & PF_EXITING) 477 if (thread->flags & PF_EXITING)
479 continue; 478 continue;
480 if (unlikely(pid_ns->child_reaper == father)) 479 if (unlikely(pid_ns->child_reaper == father))
@@ -511,11 +510,10 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
511 break; 510 break;
512 if (!reaper->signal->is_child_subreaper) 511 if (!reaper->signal->is_child_subreaper)
513 continue; 512 continue;
514 thread = reaper; 513 for_each_thread(reaper, thread) {
515 do {
516 if (!(thread->flags & PF_EXITING)) 514 if (!(thread->flags & PF_EXITING))
517 return thread; 515 return thread;
518 } while_each_thread(reaper, thread); 516 }
519 } 517 }
520 } 518 }
521 519