@@ -51,6 +51,7 @@ __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)
5151
5252EXPORT_SYMBOL (__mutex_init );
5353
54+ #ifndef CONFIG_DEBUG_LOCK_ALLOC
5455/*
5556 * We split the mutex lock/unlock logic into separate fastpath and
5657 * slowpath functions, to reduce the register pressure on the fastpath.
@@ -92,6 +93,7 @@ void inline fastcall __sched mutex_lock(struct mutex *lock)
9293}
9394
9495EXPORT_SYMBOL (mutex_lock );
96+ #endif
9597
9698static void fastcall noinline __sched
9799__mutex_unlock_slowpath (atomic_t * lock_count );
@@ -122,7 +124,8 @@ EXPORT_SYMBOL(mutex_unlock);
122124 * Lock a mutex (possibly interruptible), slowpath:
123125 */
124126static inline int __sched
125- __mutex_lock_common (struct mutex * lock , long state , unsigned int subclass )
127+ __mutex_lock_common (struct mutex * lock , long state , unsigned int subclass ,
128+ unsigned long ip )
126129{
127130 struct task_struct * task = current ;
128131 struct mutex_waiter waiter ;
@@ -132,7 +135,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass)
132135 spin_lock_mutex (& lock -> wait_lock , flags );
133136
134137 debug_mutex_lock_common (lock , & waiter );
135- mutex_acquire (& lock -> dep_map , subclass , 0 , _RET_IP_ );
138+ mutex_acquire (& lock -> dep_map , subclass , 0 , ip );
136139 debug_mutex_add_waiter (lock , & waiter , task_thread_info (task ));
137140
138141 /* add waiting tasks to the end of the waitqueue (FIFO): */
@@ -143,7 +146,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass)
143146 if (old_val == 1 )
144147 goto done ;
145148
146- lock_contended (& lock -> dep_map , _RET_IP_ );
149+ lock_contended (& lock -> dep_map , ip );
147150
148151 for (;;) {
149152 /*
@@ -166,7 +169,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass)
166169 if (unlikely (state == TASK_INTERRUPTIBLE &&
167170 signal_pending (task ))) {
168171 mutex_remove_waiter (lock , & waiter , task_thread_info (task ));
169- mutex_release (& lock -> dep_map , 1 , _RET_IP_ );
172+ mutex_release (& lock -> dep_map , 1 , ip );
170173 spin_unlock_mutex (& lock -> wait_lock , flags );
171174
172175 debug_mutex_free_waiter (& waiter );
@@ -197,20 +200,12 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass)
197200 return 0 ;
198201}
199202
200- static void fastcall noinline __sched
201- __mutex_lock_slowpath (atomic_t * lock_count )
202- {
203- struct mutex * lock = container_of (lock_count , struct mutex , count );
204-
205- __mutex_lock_common (lock , TASK_UNINTERRUPTIBLE , 0 );
206- }
207-
208203#ifdef CONFIG_DEBUG_LOCK_ALLOC
209204void __sched
210205mutex_lock_nested (struct mutex * lock , unsigned int subclass )
211206{
212207 might_sleep ();
213- __mutex_lock_common (lock , TASK_UNINTERRUPTIBLE , subclass );
208+ __mutex_lock_common (lock , TASK_UNINTERRUPTIBLE , subclass , _RET_IP_ );
214209}
215210
216211EXPORT_SYMBOL_GPL (mutex_lock_nested );
@@ -219,7 +214,7 @@ int __sched
219214mutex_lock_interruptible_nested (struct mutex * lock , unsigned int subclass )
220215{
221216 might_sleep ();
222- return __mutex_lock_common (lock , TASK_INTERRUPTIBLE , subclass );
217+ return __mutex_lock_common (lock , TASK_INTERRUPTIBLE , subclass , _RET_IP_ );
223218}
224219
225220EXPORT_SYMBOL_GPL (mutex_lock_interruptible_nested );
@@ -271,6 +266,7 @@ __mutex_unlock_slowpath(atomic_t *lock_count)
271266 __mutex_unlock_common_slowpath (lock_count , 1 );
272267}
273268
269+ #ifndef CONFIG_DEBUG_LOCK_ALLOC
274270/*
275271 * Here come the less common (and hence less performance-critical) APIs:
276272 * mutex_lock_interruptible() and mutex_trylock().
@@ -298,13 +294,22 @@ int fastcall __sched mutex_lock_interruptible(struct mutex *lock)
298294
299295EXPORT_SYMBOL (mutex_lock_interruptible );
300296
297+ static void fastcall noinline __sched
298+ __mutex_lock_slowpath (atomic_t * lock_count )
299+ {
300+ struct mutex * lock = container_of (lock_count , struct mutex , count );
301+
302+ __mutex_lock_common (lock , TASK_UNINTERRUPTIBLE , 0 , _RET_IP_ );
303+ }
304+
301305static int fastcall noinline __sched
302306__mutex_lock_interruptible_slowpath (atomic_t * lock_count )
303307{
304308 struct mutex * lock = container_of (lock_count , struct mutex , count );
305309
306- return __mutex_lock_common (lock , TASK_INTERRUPTIBLE , 0 );
310+ return __mutex_lock_common (lock , TASK_INTERRUPTIBLE , 0 , _RET_IP_ );
307311}
312+ #endif
308313
309314/*
310315 * Spinlock based trylock, we take the spinlock and check whether we
0 commit comments