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


Groups > linux.kernel > #1355026

[tip:locking/core] locking/csd_lock: Use smp_cond_acquire() in csd_lock_wait()

From tip-bot for Davidlohr Bueso <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:locking/core] locking/csd_lock: Use smp_cond_acquire() in csd_lock_wait()
Date 2016-03-10 12:10 +0100
Message-ID <rb6DF-6cT-39@gated-at.bofh.it> (permalink)
References <raY3p-8ft-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH -tip 0/2] kernel/smp: Small csd_lock optimizations Davidlohr Bueso <dbueso@suse.de> - 2016-03-10 03:00 +0100
  [PATCH 1/2] kernel/smp: Explicitly inline cds_lock helpers Davidlohr Bueso <dbueso@suse.de> - 2016-03-10 03:00 +0100
    [tip:locking/core] locking/csd_lock: Explicitly inline csd_lock*()  helpers tip-bot for Davidlohr Bueso <tipbot@zytor.com> - 2016-03-10 12:10 +0100
  [PATCH 2/2] kernel/smp: Use make csd_lock_wait be smp_cond_acquire Davidlohr Bueso <dbueso@suse.de> - 2016-03-10 03:00 +0100
    [tip:locking/core] locking/csd_lock: Use smp_cond_acquire() in  csd_lock_wait() tip-bot for Davidlohr Bueso <tipbot@zytor.com> - 2016-03-10 12:10 +0100
  Re: [PATCH -tip 0/2] kernel/smp: Small csd_lock optimizations Peter Zijlstra <peterz@infradead.org> - 2016-03-10 10:20 +0100

csiph-web