aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/mutex.c
diff options
context:
space:
mode:
authorWaiman Long <Waiman.Long@hp.com>2013-04-17 15:23:14 -0400
committerIngo Molnar <mingo@kernel.org>2013-04-19 03:33:36 -0400
commitcc189d2513d1f45cde87a9043fe3be28559c7490 (patch)
tree064796cc597cfae5cc657d8bdc212774ea5251ff /kernel/mutex.c
parent2bd2c92cf07cc4a373bf316c75b78ac465fefd35 (diff)
mutex: Back out architecture specific check for negative mutex count
Linus suggested that probably all the supported architectures can allow a negative mutex count without incorrect behavior, so we can then back out the architecture specific change and allow the mutex count to go to any negative number. That should further reduce contention for non-x86 architecture. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Waiman Long <Waiman.Long@hp.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Chandramouleeswaran Aswin <aswin@hp.com> Cc: Davidlohr Bueso <davidlohr.bueso@hp.com> Cc: Norton Scott J <scott.norton@hp.com> Cc: Rik van Riel <riel@redhat.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: David Howells <dhowells@redhat.com> Cc: Dave Jones <davej@redhat.com> Cc: Clark Williams <williams@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1366226594-5506-5-git-send-email-Waiman.Long@hp.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/mutex.c')
-rw-r--r--kernel/mutex.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 1dbd4210baef..ad53a664f113 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -38,15 +38,10 @@
38#endif 38#endif
39 39
40/* 40/*
41 * A mutex count of -1 indicates that waiters are sleeping waiting for the 41 * A negative mutex count indicates that waiters are sleeping waiting for the
42 * mutex. Some architectures can allow any negative number, not just -1, for 42 * mutex.
43 * this purpose.
44 */ 43 */
45#ifdef __ARCH_ALLOW_ANY_NEGATIVE_MUTEX_COUNT
46#define MUTEX_SHOW_NO_WAITER(mutex) (atomic_read(&(mutex)->count) >= 0) 44#define MUTEX_SHOW_NO_WAITER(mutex) (atomic_read(&(mutex)->count) >= 0)
47#else
48#define MUTEX_SHOW_NO_WAITER(mutex) (atomic_read(&(mutex)->count) != -1)
49#endif
50 45
51void 46void
52__mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) 47__mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)