locking/pvqspinlock: Replace xchg() by the more descriptive set_mb()
authorWaiman Long <[email protected]>
Mon, 11 May 2015 01:17:10 +0000 (21:17 -0400)
committerIngo Molnar <[email protected]>
Mon, 11 May 2015 07:51:52 +0000 (09:51 +0200)
The xchg() function was used in pv_wait_node() to set a certain
value and provide a memory barrier which is what the set_mb()
function is for.  This patch replaces the xchg() call by
set_mb().

Suggested-by: Linus Torvalds <[email protected]>
Signed-off-by: Waiman Long <[email protected]>
Cc: Douglas Hatch <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Scott J Norton <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/locking/qspinlock_paravirt.h

index b5758a95a8d365d0e54d1317f39f6e58a84f6b64..27ab96dca68c3e6b07e4605ce77b0831f1bee9cc 100644 (file)
@@ -175,7 +175,7 @@ static void pv_wait_node(struct mcs_spinlock *node)
                 *
                 * Matches the xchg() from pv_kick_node().
                 */
-               (void)xchg(&pn->state, vcpu_halted);
+               set_mb(pn->state, vcpu_halted);
 
                if (!READ_ONCE(node->locked))
                        pv_wait(&pn->state, vcpu_halted);