summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-30 12:35:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-30 12:35:15 -0700
commitfa7eadab4b4aec0139d2429e6f8d13375ff8a658 (patch)
tree91b4ef421d415b782ff54cc89296268903fc9552
parentbc7d352c5e76c74c628a39b99777a1bdddde5e81 (diff)
parentfd6be105b883244127a734ac9f14ae94a022dcc0 (diff)
downloadlinux-fa7eadab4b4aec0139d2429e6f8d13375ff8a658.tar.gz
linux-fa7eadab4b4aec0139d2429e6f8d13375ff8a658.tar.bz2
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
-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.
*/