diff --git a/kernel/mutex.c b/kernel/mutex.c index 632f04c57d82b0207608f10a57f95582833489c1..4c0b7b3e6d2e9a483c6cb4cc384e979911ed03bb 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -171,6 +171,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, for (;;) { 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.