Re: [PATCH v4 0/5] locking: contended_release tracepoint instrumentation

From: Steven Rostedt

Date: Thu Mar 26 2026 - 13:03:22 EST


On Thu, 26 Mar 2026 15:55:21 +0000
Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:

> > - The holder's stack at release time, which may differ from what perf lock
> > contention --lock-owner captures if the holder does significant work between
> > the waiter's arrival and the unlock.
>
> As someone who's not an expert in this area (so please use short words
> to explain it to me), why do we want to know how long this holder took
> to release the lock from when it became contended?
>
> I understand why we want to know how long any given waiter had to wait
> to gain the lock (but we already have tracepoints which show that).
>
> I also don't understand why we want to know the holder's stack at
> release time. The stack at contention-begin time will include
> the point at which the lock was acquired which should be correlated
> with where the lock was released.
>
> Perhaps examples might help me understand why we want this?

Dmitry could give his own rationale for this, but I have my only use case.

This would be useful to find out how long the critical section is. If a
lock is highly contended by many tasks, you could get a high contention
time simply because other tasks are causing the delay for the waiter.
Seeing the release time and location would let you also know how long the
critical section was held, and if the length of the critical section is
causing the contention.

Having a stack trace of the release would differentiate the path that
released the lock, as there can be many places that release them. Although,
I have to admit, I'm not sure there are many different places locks are
released. Especially now that we have guard(), which will make all the
releases in a function at the same location.

-- Steve