Skip to content

Commit fa7eada

Browse files
committed
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: mutex: Fix optimistic spinning vs. BKL
2 parents bc7d352 + fd6be10 commit fa7eada

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/mutex.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
171171
for (;;) {
172172
struct thread_info *owner;
173173

174+
/*
175+
* If we own the BKL, then don't spin. The owner of
176+
* the mutex might be waiting on us to release the BKL.
177+
*/
178+
if (unlikely(current->lock_depth >= 0))
179+
break;
180+
174181
/*
175182
* If there's an owner, wait for it to either
176183
* release the lock or go to sleep.

0 commit comments

Comments
 (0)