mutex: Better control mutex adaptive spinning config
PATCH 1/2 mutex: Better control mutex adaptive spinning config
Introduce CONFIG_MUTEX_SPIN_ON_OWNER so that we can centralize in a single place the conditions that determine its definition and use.
--- kernel/Kconfig.locks | 3 +++ kernel/mutex.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
kernel/Kconfig.locks +3 -0
@@ -197,3 +197,6 @@ config INLINE_WRITE_UNLOCK_IRQ config INLINE_WRITE_UNLOCK_IRQRESTORE def_bool !DEBUG_SPINLOCK && ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE + +config MUTEX_SPIN_ON_OWNER + def_bool SMP && !DEBUG_MUTEXES && !HAVE_DEFAULT_NO_SPIN_MUTEXES
kernel/mutex.c +2 -2
@@ -148,8 +148,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,preempt_disable ();mutex_acquire (&lock->dep_map, subclass,0 , ip); -#if defined(CONFIG_SMP ) && !defined(CONFIG_DEBUG_MUTEXES ) && \ - !defined(CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES ) + +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER /* * Optimistic spinning. *
Signature · 1 line
1.6.2.3
PATCH 2/2 mutex: Fix missing conditions to build mutex_spin_on_owner()
We don't need to build mutex_spin_on_owner() if we have CONFIG_DEBUG_MUTEXES or CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES as it won't be used under such configs.
Use CONFIG_MUTEX_SPIN_ON_OWNER as it gathers all the necessary checks before building it.
--- kernel/sched.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched.c +1 -1
@@ -5527,7 +5527,7 @@ need_resched_nonpreemptible: }EXPORT_SYMBOL (schedule); -#ifdef CONFIG_SMP +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER /* * Look out! "owner" is an entirely speculative pointer * access and not reliable.
Signature · 1 line
1.6.2.3
[tip:core/locking] mutex: Fix missing conditions to build mutex_spin_on_owner()
Commit-ID: c08f782985eed9959438368e84ce1d7f2ed03d95 Gitweb: http://git.kernel.org/tip/c08f782985eed9959438368e84ce1d7f2ed03d95 Author: Frederic Weisbecker <[email protected]> AuthorDate: Wed, 2 Dec 2009 20:49:17 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 3 Dec 2009 11:50:11 +0100
mutex: Fix missing conditions to build mutex_spin_on_owner()
We don't need to build mutex_spin_on_owner() if we have CONFIG_DEBUG_MUTEXES or CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES as it won't be used under such configs.
Use CONFIG_MUTEX_SPIN_ON_OWNER as it gathers all the necessary checks before building it.
LKML-Reference: <[email protected]>
--- kernel/sched.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched.c +1 -1
@@ -5481,7 +5481,7 @@ need_resched_nonpreemptible: }EXPORT_SYMBOL (schedule); -#ifdef CONFIG_SMP +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER /* * Look out! "owner" is an entirely speculative pointer * access and not reliable.
Commit-ID: c02260277e472095ffb3ad893be5eeab9dcefde3 Gitweb: http://git.kernel.org/tip/c02260277e472095ffb3ad893be5eeab9dcefde3 Author: Frederic Weisbecker <[email protected]> AuthorDate: Wed, 2 Dec 2009 20:49:16 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 3 Dec 2009 11:50:11 +0100
mutex: Better control mutex adaptive spinning config
Introduce CONFIG_MUTEX_SPIN_ON_OWNER so that we can centralize in a single place the conditions that determine its definition and use.
LKML-Reference: <[email protected]>
--- kernel/Kconfig.locks | 3 +++ kernel/mutex.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
kernel/Kconfig.locks +3 -0
@@ -197,3 +197,6 @@ config INLINE_WRITE_UNLOCK_IRQ config INLINE_WRITE_UNLOCK_IRQRESTORE def_bool !DEBUG_SPINLOCK && ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE + +config MUTEX_SPIN_ON_OWNER + def_bool SMP && !DEBUG_MUTEXES && !HAVE_DEFAULT_NO_SPIN_MUTEXES
kernel/mutex.c +2 -2
@@ -148,8 +148,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,preempt_disable ();mutex_acquire (&lock->dep_map, subclass,0 , ip); -#if defined(CONFIG_SMP ) && !defined(CONFIG_DEBUG_MUTEXES ) && \ - !defined(CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES ) + +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER /* * Optimistic spinning. *