Re: [RFC PATCH 1/2] locking: add mutex_lock_nospin()

From
David Laight <hidden>
Date
2026-03-04 09:54:18
Also in
bpf, lkml
Reply to
Peter Zijlstra, 2026-03-04
On Wed, 4 Mar 2026 10:02:49 +0100
Peter Zijlstra [off-list ref] wrote:
On Wed, Mar 04, 2026 at 03:46:49PM +0800, Yafang Shao wrote:
quoted
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
Thread (29 messages) 29 messages, 5 authors, last reply 2026-03-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help