[tip:locking/core] locking/pvqspinlock: Replace xchg() by the more descriptive set_mb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  52c9d2badd1ae4d11c29de57d4e964e48afd3cb4
Gitweb:     http://git.kernel.org/tip/52c9d2badd1ae4d11c29de57d4e964e48afd3cb4
Author:     Waiman Long <Waiman.Long@xxxxxx>
AuthorDate: Sun, 10 May 2015 21:17:10 -0400
Committer:  Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Mon, 11 May 2015 09:51:52 +0200

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@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Waiman Long <Waiman.Long@xxxxxx>
Cc: Douglas Hatch <doug.hatch@xxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Scott J Norton <scott.norton@xxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
 kernel/locking/qspinlock_paravirt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
index b5758a9..27ab96d 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -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);
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux