summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-09-02 13:52:25 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-02 13:52:24 -0700
commitca667c3ef5adb41acfae7e834ce3bac8063b626b (patch)
tree0722ae304dace6a375e60dd13cb9d4f0a8f56439 /kernel
parentcf923055eb1ef766205a999c2cc9508ea9000c88 (diff)
parentdbc6f463a6fa80326c7f508245eb8ddae499d656 (diff)
Merge "mutex: Add a delay into the SPIN_ON_OWNER wait loop."
Diffstat (limited to 'kernel')
-rw-r--r--kernel/locking/mutex.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 0551c219c40e..fb42418507ae 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -26,6 +26,7 @@
#include <linux/interrupt.h>
#include <linux/debug_locks.h>
#include <linux/osq_lock.h>
+#include <linux/delay.h>
/*
* In the DEBUG case we are using the "NULL fastpath" for mutexes,
@@ -378,6 +379,17 @@ static bool mutex_optimistic_spin(struct mutex *lock,
* values at the cost of a few extra spins.
*/
cpu_relax_lowlatency();
+
+ /*
+ * On arm systems, we must slow down the waiter's repeated
+ * aquisition of spin_mlock and atomics on the lock count, or
+ * we risk starving out a thread attempting to release the
+ * mutex. The mutex slowpath release must take spin lock
+ * wait_lock. This spin lock can share a monitor with the
+ * other waiter atomics in the mutex data structure, so must
+ * take care to rate limit the waiters.
+ */
+ udelay(1);
}
osq_unlock(&lock->osq);