Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1377482
| From | Jason Low <jason.low2@hp.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] MCS spinlock: Use smp_cond_load_acquire() |
| Date | 2016-04-13 05:10 +0200 |
| Message-ID | <rnjlL-29L-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
For qspinlocks on ARM64, we would like to use WFE instead
of purely spinning. Qspinlocks internally have lock
contenders spin on an MCS lock.
Update arch_mcs_spin_lock_contended() such that it uses
the new smp_cond_load_acquire() so that ARM64 can also
override this spin loop with its own implementation using WFE.
On x86, it can also cheaper to use this than spinning on
smp_load_acquire().
Signed-off-by: Jason Low <jason.low2@hp.com>
---
Changes from v1:
- Pass l instead of &l to smp_cond_load_acquire() since
l is already a pointer to the lock variable.
kernel/locking/mcs_spinlock.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/locking/mcs_spinlock.h b/kernel/locking/mcs_spinlock.h
index c835270..1c55987 100644
--- a/kernel/locking/mcs_spinlock.h
+++ b/kernel/locking/mcs_spinlock.h
@@ -22,13 +22,13 @@ struct mcs_spinlock {
#ifndef arch_mcs_spin_lock_contended
/*
- * Using smp_load_acquire() provides a memory barrier that ensures
- * subsequent operations happen after the lock is acquired.
+ * Using smp_cond_load_acquire() provides the acquire semantics
+ * required so that subsequent operations happen after the
+ * lock is acquired.
*/
#define arch_mcs_spin_lock_contended(l) \
do { \
- while (!(smp_load_acquire(l))) \
- cpu_relax_lowlatency(); \
+ smp_cond_load_acquire(l, VAL); \
} while (0)
#endif
--
2.1.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2] MCS spinlock: Use smp_cond_load_acquire() Jason Low <jason.low2@hp.com> - 2016-04-13 05:10 +0200
Re: [PATCH v2] MCS spinlock: Use smp_cond_load_acquire() Will Deacon <will.deacon@arm.com> - 2016-04-13 19:50 +0200
Re: [PATCH v2] MCS spinlock: Use smp_cond_load_acquire() Jason Low <jason.low2@hp.com> - 2016-04-13 23:00 +0200
Re: [PATCH v2] MCS spinlock: Use smp_cond_load_acquire() Will Deacon <will.deacon@arm.com> - 2016-04-14 11:00 +0200
csiph-web