Skip to content

Commit

Permalink
pi-futex: set PF_EXITING without taking ->pi_lock
Browse files Browse the repository at this point in the history
It is a bit annoying that do_exit() takes ->pi_lock to set PF_EXITING.  All
we need is to synchronize with lookup_pi_state() which saw this task
without PF_EXITING under ->pi_lock.

Change do_exit() to use spin_unlock_wait().

Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Oct 17, 2007
1 parent 7917ff9 commit d2ee719
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,13 +931,13 @@ fastcall NORET_TYPE void do_exit(long code)
schedule();
}

tsk->flags |= PF_EXITING;
/*
* tsk->flags are checked in the futex code to protect against
* an exiting task cleaning up the robust pi futexes.
*/
spin_lock_irq(&tsk->pi_lock);
tsk->flags |= PF_EXITING;
spin_unlock_irq(&tsk->pi_lock);
smp_mb();
spin_unlock_wait(&tsk->pi_lock);

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

0 comments on commit d2ee719

Please sign in to comment.