Skip to content

Commit

Permalink
exit: Replace spin_unlock_wait() with lock/unlock pair
Browse files Browse the repository at this point in the history
There is no agreed-upon definition of spin_unlock_wait()'s semantics, and
it appears that all callers could do just as well with a lock/unlock pair.
This commit therefore replaces the spin_unlock_wait() call in do_exit()
with spin_lock() followed immediately by spin_unlock().  This should be
safe from a performance perspective because the lock is a per-task lock,
and this is happening only at task-exit time.

Signed-off-by: Paul E. McKenney <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Andrea Parri <[email protected]>
Cc: Linus Torvalds <[email protected]>
  • Loading branch information
paulmck committed Aug 17, 2017
1 parent dec13c4 commit 8083f29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,8 @@ void __noreturn do_exit(long code)
* Ensure that we must observe the pi_state in exit_mm() ->
* mm_release() -> exit_pi_state_list().
*/
raw_spin_unlock_wait(&tsk->pi_lock);
raw_spin_lock_irq(&tsk->pi_lock);
raw_spin_unlock_irq(&tsk->pi_lock);

if (unlikely(in_atomic())) {
pr_info("note: %s[%d] exited with preempt_count %d\n",
Expand Down

0 comments on commit 8083f29

Please sign in to comment.