projects/linux·commit fa7eadab

Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

fa7eadab · Linus Torvalds <[email protected]> · 2010-05-30 12:35:15 -07:00

* '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
Commit
fa7eadab4b4aec0139d2429e6f8d13375ff8a658
Parents
bc7d352c · fd6be105

Merge commit. Changes below are compared with the first parent: bc7d352c.

Changes

1 files changed · +7 −0

FileStatusAddDelContent
kernel/mutex.cmodified+7−0View file

kernel/mutex.c

View file
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 632f04c..4c0b7b3 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.
*/