diff options
-rw-r--r-- | kernel/locking/mutex.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 2670b84067d6..02c61a9c8906 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c | |||
@@ -468,6 +468,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, | |||
468 | } | 468 | } |
469 | osq_unlock(&lock->osq); | 469 | osq_unlock(&lock->osq); |
470 | slowpath: | 470 | slowpath: |
471 | /* | ||
472 | * If we fell out of the spin path because of need_resched(), | ||
473 | * reschedule now, before we try-lock the mutex. This avoids getting | ||
474 | * scheduled out right after we obtained the mutex. | ||
475 | */ | ||
476 | if (need_resched()) | ||
477 | schedule_preempt_disabled(); | ||
471 | #endif | 478 | #endif |
472 | spin_lock_mutex(&lock->wait_lock, flags); | 479 | spin_lock_mutex(&lock->wait_lock, flags); |
473 | 480 | ||