Skip to content

RFC disable optimistic spinning for ftrace_lock

Yafang Shao linux-trace-kernel lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest3 patches 9 repliesIn review
  2. v1 RFC2 patches 26 repliesSuperseded

Changes in v2 from the cover letter

- add slow_mutex_[un]lock (Steven)
- add variant for rtmutex (Waiman)
- revise commit log for clarity and accuracy (Waiman, Peter)
- note that semaphores may present similar challenges (David)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3locking/mutex: Add slow path variants for lock/unlockinclude/linux/mutex.h kernel/locking/mutex.c+38 -70 replies
2/3locking/rtmutex: Add slow path variants for lock/unlockinclude/linux/rtmutex.h kernel/locking/rtmutex.c kernel/locking/rtmutex_api.c+66 -210 replies
3/3ftrace: Disable optimistic spinning for ftrace_lockkernel/trace/ftrace.c+53 -530 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCH v2 0/3] disable optimistic spinning for ftrace_lock

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

v1->v2:
- add slow_mutex_[un]lock (Steven)
- add variant for rtmutex (Waiman)
- revise commit log for clarity and accuracy (Waiman, Peter)
- note that semaphores may present similar challenges (David)

RFC v1: https://lore.kernel.org/bpf/[email protected]/

Yafang Shao (3):
locking/mutex: Add slow path variants for lock/unlock locking/rtmutex: Add slow path variants for lock/unlock
ftrace: Disable optimistic spinning for ftrace_lock

 include/linux/mutex.h        |   4 ++
 include/linux/rtmutex.h      |   3 +
 kernel/locking/mutex.c       |  41 +++++++++++---
 kernel/locking/rtmutex.c     |  37 +++++++-----
 kernel/locking/rtmutex_api.c |  47 +++++++++++++---
 kernel/trace/ftrace.c        | 106 +++++++++++++++++------------------
 6 files changed, 157 insertions(+), 81 deletions(-)
Signature · 1 line
2.47.3