Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1a7a1df authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mutex: Add a delay into the SPIN_ON_OWNER wait loop."

parents 0109132b 1e5a5b5e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/debug_locks.h>
#include <linux/osq_lock.h>
#include <linux/delay.h>

#ifdef CONFIG_DEBUG_MUTEXES
# include "mutex-debug.h"
@@ -555,6 +556,17 @@ mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx,
		 * values at the cost of a few extra spins.
		 */
		cpu_relax();

		/*
		 * 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);
	}

	if (!waiter)