aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-12-10 15:54:51 -0800
committerMoyster <oysterized@gmail.com>2019-05-02 18:26:04 +0200
commit1b92683e31af28b4be2837a2299fc8076f5bb6d7 (patch)
treebbb31bf5e29c41aa65dce71490ab7b926bb2dafc
parent50ca81d617cbdb8af47e2992ad5299ca0991156f (diff)
exit: wait: drop tasklist_lock before psig->c* accounting
wait_task_zombie() no longer needs tasklist_lock to accumulate the psig->c* counters, we can drop it right after cmpxchg(exit_state). Change-Id: I7cc68ac84ce681c95c0a532454ba79ffa6fc35a9 Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Aaron Tomlin <atomlin@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Rik van Riel <riel@redhat.com> Cc: Sterling Alexander <stalexan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/exit.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 3c2d915f1..e09376974 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1023,6 +1023,11 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
EXIT_TRACE : EXIT_DEAD;
if (cmpxchg(&p->exit_state, EXIT_ZOMBIE, state) != EXIT_ZOMBIE)
return 0;
+ /*
+ * We own this thread, nobody else can reap it.
+ */
+ read_unlock(&tasklist_lock);
+ sched_annotate_sleep();
/*
* Check thread_group_leader() to exclude the traced sub-threads.
@@ -1081,13 +1086,6 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
spin_unlock_irq(&p->real_parent->sighand->siglock);
}
- /*
- * Now we are sure this task is interesting, and no other
- * thread can reap it because we its state == DEAD/TRACE.
- */
- read_unlock(&tasklist_lock);
- sched_annotate_sleep();
-
retval = wo->wo_rusage
? getrusage(p, RUSAGE_BOTH, wo->wo_rusage) : 0;
status = (p->signal->flags & SIGNAL_GROUP_EXIT)