summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-30 21:35:15 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-30 21:35:15 +0200
commitfa7eadab4b4aec0139d2429e6f8d13375ff8a658 (patch)
tree91b4ef421d415b782ff54cc89296268903fc9552 /kernel
parentMerge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/ker... (diff)
parentmutex: Fix optimistic spinning vs. BKL (diff)
downloadlinux-fa7eadab4b4aec0139d2429e6f8d13375ff8a658.tar.xz
linux-fa7eadab4b4aec0139d2429e6f8d13375ff8a658.zip
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
Diffstat (limited to 'kernel')
-rw-r--r--kernel/mutex.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 632f04c57d82..4c0b7b3e6d2e 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -172,6 +172,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
struct thread_info *owner;
/*
+ * If we own the BKL, then don't spin. The owner of
+ * the mutex might be waiting on us to release the BKL.
+ */
+ if (unlikely(current->lock_depth >= 0))
+ break;
+
+ /*
* If there's an owner, wait for it to either
* release the lock or go to sleep.
*/