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

From
Yafang Shao <hidden>
Date
2026-03-05 03:09:02
Also in
linux-trace-kernel, lkml
Reply to
Steven Rostedt, 2026-03-05
On Thu, Mar 5, 2026 at 11:00 AM Steven Rostedt [off-list ref] wrote:
On Thu, 5 Mar 2026 10:33:00 +0800
Yafang Shao [off-list ref] wrote:
quoted
Other tools may also read available_filter_functions, requiring each
one to be patched individually to avoid this flaw—a clearly
impractical solution.
What exactly is the issue?
It makes no sense to spin unnecessarily when it can be avoided. We
continuously improve the kernel to do the right thing—and unnecessary
spinning is certainly not the right thing.
If a task does a while 1 in user space, it
wouldn't be much different.
The while loop in user space performs actual work, whereas useless
spinning does nothing but burn CPU cycles. My point is simple: if this
unnecessary spinning isn't already considered an issue, it should
be—it's something that clearly needs improvement.
With PREEMPT_LAZY the most a task will spin
in the kernel is one extra tick over a user space task spinning in user
space.

available_filter_functions is definitely not a hot path, so I
personally don't care if it were to use "nospin". My worry is about
adding this "special" mutex for a single corner case, and I want to know
that its a real bug before we add something special into the kernel.

-- Steve


-- 
Regards
Yafang
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