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

Commit 2e021aa5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

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

parents cb87dd7b d14b5a0c
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"
@@ -554,6 +555,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)