From: Davidlohr Bueso <dbueso@suse.de>
To: mingo@kernel.org
Cc: peterz@infradead.org, dave@stgolabs.net,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: [PATCH 2/2] kernel/smp: Use make csd_lock_wait be smp_cond_acquire
Date: Wed, 9 Mar 2016 17:55:36 -0800 [thread overview]
Message-ID: <1457574936-19065-3-git-send-email-dbueso@suse.de> (raw)
In-Reply-To: <1457574936-19065-1-git-send-email-dbueso@suse.de>
From: Davidlohr Bueso <dave@stgolabs>
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>
---
kernel/smp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/smp.c b/kernel/smp.c
index c91e00178f8f..74165443c240 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)
--
2.1.4
next prev parent reply other threads:[~2016-03-10 1:56 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 ` Davidlohr Bueso [this message]
2016-03-10 11:06 ` [tip:locking/core] locking/csd_lock: Use smp_cond_acquire() in csd_lock_wait() tip-bot for Davidlohr Bueso
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=1457574936-19065-3-git-send-email-dbueso@suse.de \
--to=dbueso@suse.de \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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