Commit ca50e426 authored by Pan Xinhui's avatar Pan Xinhui Committed by Ingo Molnar

locking/qspinlock: Use atomic_sub_return_release() in queued_spin_unlock()

The existing version uses a heavy barrier while only release semantics
is required. So use atomic_sub_return_release() instead.
Suggested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarPan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Signed-off-by: default avatarPeter 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: arnd@arndb.de
Cc: waiman.long@hp.com
Link: http://lkml.kernel.org/r/1464943094-3129-1-git-send-email-xinhui.pan@linux.vnet.ibm.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 6428671b
...@@ -111,10 +111,9 @@ static __always_inline void queued_spin_lock(struct qspinlock *lock) ...@@ -111,10 +111,9 @@ static __always_inline void queued_spin_lock(struct qspinlock *lock)
static __always_inline void queued_spin_unlock(struct qspinlock *lock) static __always_inline void queued_spin_unlock(struct qspinlock *lock)
{ {
/* /*
* smp_mb__before_atomic() in order to guarantee release semantics * unlock() needs release semantics:
*/ */
smp_mb__before_atomic(); (void)atomic_sub_return_release(_Q_LOCKED_VAL, &lock->val);
atomic_sub(_Q_LOCKED_VAL, &lock->val);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment