# Re: \[RFC PATCH v2 0/3\] disable optimistic spinning for ftrace\_lock

- From: Peter Zijlstra \<peterz@infradead.org\>
- Date: 2026-03-11 11:54:39 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/03/3453154
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/03/3453149/t.md

```text
On Wed, Mar 11, 2026 at 07:52:47PM +0800, Yafang Shao wrote:
> 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.
```
