From: Jason Low <jason.low2@hp.com>
To: Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will.deacon@arm.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com,
paulmck@linux.vnet.ibm.com, terry.rudd@hpe.com,
waiman.long@hpe.com, boqun.feng@gmail.com, dave@stgolabs.net,
jason.low2@hp.com, kbuild test robot <lkp@intel.com>,
kbuild-all@01.org
Subject: [PATCH v2] MCS spinlock: Use smp_cond_load_acquire()
Date: Tue, 12 Apr 2016 20:02:17 -0700 [thread overview]
Message-ID: <1460516537.2709.7.camel@j-VirtualBox> (raw)
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
next reply other threads:[~2016-04-13 3:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 3:02 Jason Low [this message]
2016-04-13 17:43 ` [PATCH v2] MCS spinlock: Use smp_cond_load_acquire() Will Deacon
2016-04-13 20:49 ` Jason Low
2016-04-14 8:53 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460516537.2709.7.camel@j-VirtualBox \
--to=jason.low2@hp.com \
--cc=boqun.feng@gmail.com \
--cc=dave@stgolabs.net \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=terry.rudd@hpe.com \
--cc=torvalds@linux-foundation.org \
--cc=waiman.long@hpe.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.