Skip to contentSkip to conversation

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

PATCH New Waiman Long 1 participant 1 message May 11, 2015 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
 kernel/locking/qspinlock_paravirt.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/locking/qspinlock_paravirt.h +1 -1
index b5758a9..27ab96d 100644
@@ -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);
Signature · 1 line
1.7.1