Skip to content

Commit

Permalink
locking/pvqspinlock: Replace xchg() by the more descriptive set_mb()
Browse files Browse the repository at this point in the history
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 <torvalds@linux-foundation.org>
Signed-off-by: Waiman Long <Waiman.Long@hp.com>
Cc: Douglas Hatch <doug.hatch@hp.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Scott J Norton <scott.norton@hp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Waiman Long authored and Ingo Molnar committed May 11, 2015
1 parent e95e6f1 commit 52c9d2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/locking/qspinlock_paravirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 52c9d2b

Please sign in to comment.