Skip to content

Commit c022602

Browse files
fweisbecIngo Molnar
authored andcommitted
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. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <1259783357-8542-1-git-send-regression-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org>
1 parent fa1452e commit c022602

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎kernel/Kconfig.locks‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,6 @@ config INLINE_WRITE_UNLOCK_IRQ
197197

198198
config INLINE_WRITE_UNLOCK_IRQRESTORE
199199
def_bool !DEBUG_SPINLOCK && ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
200+
201+
config MUTEX_SPIN_ON_OWNER
202+
def_bool SMP && !DEBUG_MUTEXES && !HAVE_DEFAULT_NO_SPIN_MUTEXES

‎kernel/mutex.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
148148

149149
preempt_disable();
150150
mutex_acquire(&lock->dep_map, subclass, 0, ip);
151-
#if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES) && \
152-
!defined(CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES)
151+
152+
#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
153153
/*
154154
* Optimistic spinning.
155155
*

0 commit comments

Comments
 (0)