On Wed, Mar 11, 2026 at 7:54 PM Peter Zijlstra [off-list ref] wrote:
On Wed, Mar 11, 2026 at 07:52:47PM +0800, Yafang Shao wrote:
quoted
Recently, we resolved a latency spike issue caused by concurrently running
bpftrace processes. The root cause was high contention on the ftrace_lock
due to optimistic spinning. We can optimize this by disabling optimistic
spinning for ftrace_lock.
While semaphores may present similar challenges, I'm not currently aware of
specific instances that exhibit this exact issue. Should we encounter
problematic semaphores in production workloads, we can address them at that
time.
PATCH #1: introduce slow_mutex_[un]lock to disable optimistic spinning
PATCH #2: add variant for rtmutex
PATCH #3: disable optimistic spinning for ftrace_lock
So I really utterly hate this.
Do you have any other suggestions for optimizing this?
--
Regards
Yafang