locking/spinlock: Update spin_unlock_wait() users
authorPeter Zijlstra <peterz@infradead.org>
Tue, 24 May 2016 12:45:21 +0000 (14:45 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 14 Jun 2016 09:55:15 +0000 (11:55 +0200)
With the modified semantics of spin_unlock_wait() a number of
explicit barriers can be removed. Also update the comment for the
do_exit() usecase, as that was somewhat stale/obscure.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
ipc/sem.c
kernel/exit.c
kernel/task_work.c

index 84dff3df11a4ab8088cf6577588a6866e784a03b..ae72b3cddc8d866450314466df89d466ee7f2dd2 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -282,7 +282,6 @@ static void sem_wait_array(struct sem_array *sma)
                sem = sma->sem_base + i;
                spin_unlock_wait(&sem->lock);
        }
-       smp_acquire__after_ctrl_dep();
 }
 
 /*
index 9e6e1356e6bbc2dbb2aeb9ef5b2b02d05961ad3c..0b40791b9e70259b50458b4c67e1d3325a7a4b6b 100644 (file)
@@ -700,10 +700,14 @@ void do_exit(long code)
 
        exit_signals(tsk);  /* sets PF_EXITING */
        /*
-        * tsk->flags are checked in the futex code to protect against
-        * an exiting task cleaning up the robust pi futexes.
+        * Ensure that all new tsk->pi_lock acquisitions must observe
+        * PF_EXITING. Serializes against futex.c:attach_to_pi_owner().
         */
        smp_mb();
+       /*
+        * Ensure that we must observe the pi_state in exit_mm() ->
+        * mm_release() -> exit_pi_state_list().
+        */
        raw_spin_unlock_wait(&tsk->pi_lock);
 
        if (unlikely(in_atomic())) {
index 53fa971d000d0b7fff1b63be23007057468bf120..6ab4842b00e8bb71db357e5933fc6c3b72669832 100644 (file)
@@ -108,7 +108,6 @@ void task_work_run(void)
                 * fail, but it can play with *work and other entries.
                 */
                raw_spin_unlock_wait(&task->pi_lock);
-               smp_mb();
 
                do {
                        next = work->next;