From: tip-bot for Davidlohr Bueso <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, dbueso@suse.de,
hpa@zytor.com, torvalds@linux-foundation.org, mingo@kernel.org,
peterz@infradead.org
Subject: [tip:locking/core] locking/csd_lock: Use smp_cond_acquire() in csd_lock_wait()
Date: Thu, 10 Mar 2016 03:06:14 -0800 [thread overview]
Message-ID: <tip-38460a2178d225b39ade5ac66586c3733391cf86@git.kernel.org> (raw)
In-Reply-To: <1457574936-19065-3-git-send-email-dbueso@suse.de>
Commit-ID: 38460a2178d225b39ade5ac66586c3733391cf86
Gitweb: http://git.kernel.org/tip/38460a2178d225b39ade5ac66586c3733391cf86
Author: Davidlohr Bueso <dave@stgolabs>
AuthorDate: Wed, 9 Mar 2016 17:55:36 -0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 10 Mar 2016 10:28:35 +0100
locking/csd_lock: Use smp_cond_acquire() in csd_lock_wait()
We can micro-optimize this call and mildly relax the
barrier requirements by relying on ctrl + rmb, keeping
the acquire semantics. In addition, this is pretty much
the now standard for busy-waiting under such restraints.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dave@stgolabs.net
Link: http://lkml.kernel.org/r/1457574936-19065-3-git-send-email-dbueso@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/smp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/smp.c b/kernel/smp.c
index 5099db1..300d293 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -107,8 +107,7 @@ void __init call_function_init(void)
*/
static __always_inline void csd_lock_wait(struct call_single_data *csd)
{
- while (smp_load_acquire(&csd->flags) & CSD_FLAG_LOCK)
- cpu_relax();
+ smp_cond_acquire(!(csd->flags & CSD_FLAG_LOCK));
}
static __always_inline void csd_lock(struct call_single_data *csd)
next prev parent reply other threads:[~2016-03-10 11:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 1:55 [PATCH -tip 0/2] kernel/smp: Small csd_lock optimizations Davidlohr Bueso
2016-03-10 1:55 ` [PATCH 1/2] kernel/smp: Explicitly inline cds_lock helpers Davidlohr Bueso
2016-03-10 11:05 ` [tip:locking/core] locking/csd_lock: Explicitly inline csd_lock*() helpers tip-bot for Davidlohr Bueso
2016-03-10 1:55 ` [PATCH 2/2] kernel/smp: Use make csd_lock_wait be smp_cond_acquire Davidlohr Bueso
2016-03-10 11:06 ` tip-bot for Davidlohr Bueso [this message]
2016-03-10 9:17 ` [PATCH -tip 0/2] kernel/smp: Small csd_lock optimizations Peter Zijlstra
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=tip-38460a2178d225b39ade5ac66586c3733391cf86@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dbueso@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox