mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Davidlohr Bueso <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	torvalds@linux-foundation.org, peterz@infradead.org,
	tim.c.chen@linux.intel.com, jason.low2@hp.com,
	paulmck@linux.vnet.ibm.com, heiko.carstens@de.ibm.com,
	tglx@linutronix.de, davidlohr@hp.com
Subject: [tip:locking/core] locking/mutexes: Use MUTEX_SPIN_ON_OWNER when appropriate
Date: Wed, 13 Aug 2014 03:55:45 -0700	[thread overview]
Message-ID: <tip-7608a43d8f2e02f8b532f8e11481d7ecf8b5d3f9@git.kernel.org> (raw)
In-Reply-To: <1406752916-3341-5-git-send-email-davidlohr@hp.com>

Commit-ID:  7608a43d8f2e02f8b532f8e11481d7ecf8b5d3f9
Gitweb:     http://git.kernel.org/tip/7608a43d8f2e02f8b532f8e11481d7ecf8b5d3f9
Author:     Davidlohr Bueso <davidlohr@hp.com>
AuthorDate: Wed, 30 Jul 2014 13:41:54 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Aug 2014 10:32:02 +0200

locking/mutexes: Use MUTEX_SPIN_ON_OWNER when appropriate

4badad35 ("locking/mutex: Disable optimistic spinning on some
architectures") added a ARCH_SUPPORTS_ATOMIC_RMW flag to
disable the mutex optimistic feature on specific archs.

Because CONFIG_MUTEX_SPIN_ON_OWNER only depended on DEBUG and
SMP, it was ok to have the ->owner field conditional a bit
flexible. However by adding a new variable to the matter,
we can waste space with the unused field, ie: CONFIG_SMP &&
(!CONFIG_MUTEX_SPIN_ON_OWNER && !CONFIG_DEBUG_MUTEX).

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Acked-by: Jason Low <jason.low2@hp.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: aswin@hp.com
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jason Low <jason.low2@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Link: http://lkml.kernel.org/r/1406752916-3341-5-git-send-email-davidlohr@hp.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/mutex.h  | 2 +-
 kernel/locking/mutex.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 8d5535c..e4c2941 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -52,7 +52,7 @@ struct mutex {
 	atomic_t		count;
 	spinlock_t		wait_lock;
 	struct list_head	wait_list;
-#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
+#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
 	struct task_struct	*owner;
 #endif
 #ifdef CONFIG_MUTEX_SPIN_ON_OWNER
diff --git a/kernel/locking/mutex.h b/kernel/locking/mutex.h
index 4115fbf..5cda397 100644
--- a/kernel/locking/mutex.h
+++ b/kernel/locking/mutex.h
@@ -16,7 +16,7 @@
 #define mutex_remove_waiter(lock, waiter, ti) \
 		__list_del((waiter)->list.prev, (waiter)->list.next)
 
-#ifdef CONFIG_SMP
+#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
 static inline void mutex_set_owner(struct mutex *lock)
 {
 	lock->owner = current;

  reply	other threads:[~2014-08-13 10:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30 20:41 [PATCH -tip v2 1/7] locking/mutex: Standardize arguments in lock/unlock slowpaths Davidlohr Bueso
2014-07-30 20:41 ` [PATCH -tip v2 2/7] locking/mutex: Document quick lock release when unlocking Davidlohr Bueso
2014-08-13 10:55   ` [tip:locking/core] locking/mutexes: " tip-bot for Davidlohr Bueso
2014-07-30 20:41 ` [PATCH -tip v2 3/7] locking/mcs: Remove obsolete comment Davidlohr Bueso
2014-08-13 10:55   ` [tip:locking/core] " tip-bot for Davidlohr Bueso
2014-07-30 20:41 ` [PATCH -tip v2 4/7] locking/mutex: Refactor optimistic spinning code Davidlohr Bueso
2014-07-31  0:56   ` Jason Low
2014-08-13 10:55   ` [tip:locking/core] locking/mutexes: " tip-bot for Davidlohr Bueso
2014-07-30 20:41 ` [PATCH -tip v2 5/7] locking/mutex: Use MUTEX_SPIN_ON_OWNER when appropriate Davidlohr Bueso
2014-08-13 10:55   ` tip-bot for Davidlohr Bueso [this message]
2014-07-30 20:41 ` [PATCH -tip v2 6/7] locking: Move docs into Documentation/locking/ Davidlohr Bueso
2014-07-30 21:02   ` Randy Dunlap
2014-07-31  6:53     ` Peter Zijlstra
2014-08-13 10:56   ` [tip:locking/core] locking/Documentation: Move locking related " tip-bot for Davidlohr Bueso
2014-07-30 20:41 ` [PATCH -tip v2 7/7] Documentation: Update locking/mutex-design.txt disadvantages Davidlohr Bueso
2014-08-13 10:56   ` [tip:locking/core] locking/Documentation: Update locking/ mutex-design.txt disadvantages tip-bot for Davidlohr Bueso
2014-08-13 10:54 ` [tip:locking/core] locking/mutexes: Standardize arguments in lock /unlock slowpaths tip-bot for Davidlohr Bueso

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-7608a43d8f2e02f8b532f8e11481d7ecf8b5d3f9@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=davidlohr@hp.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --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

Powered by JetHome