Re: [RFC PATCH 1/2] locking: add mutex_lock_nospin()
From: David Laight
Date: Wed Mar 04 2026 - 04:57:44 EST
On Wed, 4 Mar 2026 10:02:49 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Wed, Mar 04, 2026 at 03:46:49PM +0800, Yafang Shao wrote:
> > Introduce mutex_lock_nospin(), a helper that disables optimistic spinning
> > on the owner for specific heavy locks. This prevents long spinning times
> > that can lead to latency spikes for other tasks on the same runqueue.
>
> This makes no sense; spinning stops on need_resched().
>
That might still be an issue if a high priority process is spinning.
But a %sys spike doesn't imply a latency spike.
Is this using the osq_lock.c code?
That will have problems on overprovisioned VMs, it tries to find out
whether the hypervisor has switched out - but ISTR that is flawed.
In reality a spin lock shouldn't be held for long enough to cause
any kind latency issue.
So something in the code that reads the list of filter functions
needs to be done differently so that the lock isn't held for as long.
David