Skip to content

Commit 52c9d2b

Browse files
longman88ingomolnar
authored andcommitted
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>
1 parent e95e6f1 commit 52c9d2b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/locking/qspinlock_paravirt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static void pv_wait_node(struct mcs_spinlock *node)
175175
*
176176
* Matches the xchg() from pv_kick_node().
177177
*/
178-
(void)xchg(&pn->state, vcpu_halted);
178+
set_mb(pn->state, vcpu_halted);
179179

180180
if (!READ_ONCE(node->locked))
181181
pv_wait(&pn->state, vcpu_halted);

0 commit comments

Comments
 (0)