Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378544 > unrolled thread

[RFC] arm64: Implement WFE based spin wait for MCS spinlocks

Started byJason Low <jason.low2@hp.com>
First post2016-04-14 09:30 +0200
Last post2016-04-14 09:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [RFC] arm64: Implement WFE based spin wait for MCS spinlocks Jason Low <jason.low2@hp.com> - 2016-04-14 09:30 +0200

#1378544 — [RFC] arm64: Implement WFE based spin wait for MCS spinlocks

FromJason Low <jason.low2@hp.com>
Date2016-04-14 09:30 +0200
Subject[RFC] arm64: Implement WFE based spin wait for MCS spinlocks
Message-ID<rnJSW-6wh-13@gated-at.bofh.it>
Use WFE to avoid most spinning with MCS spinlocks. This is implemented
with the new cmpwait() mechanism for comparing and waiting for the MCS
locked value to change using LDXR + WFE.

Signed-off-by: Jason Low <jason.low2@hp.com>
---
 arch/arm64/include/asm/mcs_spinlock.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 arch/arm64/include/asm/mcs_spinlock.h

diff --git a/arch/arm64/include/asm/mcs_spinlock.h b/arch/arm64/include/asm/mcs_spinlock.h
new file mode 100644
index 0000000..d295d9d
--- /dev/null
+++ b/arch/arm64/include/asm/mcs_spinlock.h
@@ -0,0 +1,21 @@
+#ifndef __ASM_MCS_SPINLOCK_H
+#define __ASM_MCS_SPINLOCK_H
+
+#define arch_mcs_spin_lock_contended(l)					\
+do {									\
+	int locked_val;							\
+	for (;;) {							\
+		locked_val = READ_ONCE(*l);				\
+		if (locked_val)						\
+			break;						\
+		cmpwait(l, locked_val);					\
+	}								\
+	smp_rmb();							\
+} while (0)
+
+#define arch_mcs_spin_unlock_contended(l)				\
+do {									\
+	smp_store_release(l, 1);					\
+} while (0)
+
+#endif  /* __ASM_MCS_SPINLOCK_H */
-- 
2.1.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web