Skip to content

Commit

Permalink
exit: wait: drop tasklist_lock before psig->c* accounting
Browse files Browse the repository at this point in the history
wait_task_zombie() no longer needs tasklist_lock to accumulate the
psig->c* counters, we can drop it right after cmpxchg(exit_state).

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Aaron Tomlin <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Sterling Alexander <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Dec 11, 2014
1 parent f953ccd commit 986094d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,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.
Expand Down Expand Up @@ -1064,13 +1069,6 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
spin_unlock_irq(&current->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)
Expand Down

0 comments on commit 986094d

Please sign in to comment.