Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

locking/pvqspinlock: Replace xchg() by the more descriptive set_mb()

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>

authored by

Waiman Long and committed by
Ingo Molnar
52c9d2ba e95e6f17

+1 -1
+1 -1
kernel/locking/qspinlock_paravirt.h
··· 175 175 * 176 176 * Matches the xchg() from pv_kick_node(). 177 177 */ 178 - (void)xchg(&pn->state, vcpu_halted); 178 + set_mb(pn->state, vcpu_halted); 179 179 180 180 if (!READ_ONCE(node->locked)) 181 181 pv_wait(&pn->state, vcpu_halted);