From: Oleg Nesterov Date: Wed, 17 Oct 2007 06:26:47 +0000 (-0700) Subject: pi-futex: set PF_EXITING without taking ->pi_lock X-Git-Tag: v2.6.24-rc1~719 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d2ee7198cc2414aade234a3cebc69e6cbff35d9b;p=linux-2.6-omap-h63xx.git pi-futex: set PF_EXITING without taking ->pi_lock 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 Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/exit.c b/kernel/exit.c index 6ca1e4666e9..3b8dfffd932 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -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",