Re: [PATCH v4 0/5] mm: zone lock tracepoint instrumentation

From: Dmitry Ilvokhin

Date: Wed Mar 25 2026 - 09:08:07 EST


On Tue, Mar 24, 2026 at 04:39:18PM -0700, Andrew Morton wrote:
> On Thu, 19 Mar 2026 13:22:54 +0000 Dmitry Ilvokhin <d@xxxxxxxxxxxx> wrote:
>
> > On Mon, Mar 16, 2026 at 05:40:50PM +0000, Dmitry Ilvokhin wrote:
> >
> > [...]
> >
> > > A possible generic solution is a trace_contended_release() for spin
> > > locks, for example:
> > >
> > > if (trace_contended_release_enabled() &&
> > > atomic_read(&lock->val) & ~_Q_LOCKED_MASK)
> > > trace_contended_release(lock);
> > >
> > > This might work on x86, but could increase code size and regress
> > > performance on arches where spin_unlock() is inlined, such as arm64
> > > under !PREEMPTION.
> >
> > I took a stab at this idea and submitted an RFC [1].
> >
> > The implementation builds on your earlier observation from Matthew that
> > _raw_spin_unlock() is not inlined in most configurations. In those
> > cases, when the tracepoint is disabled, this adds a single NOP on the
> > fast path, with the conditional check staying out of line. The measured
> > text size increase in this configuration is +983 bytes.
> >
> > For configurations where _raw_spin_unlock() is inlined, the
> > instrumentation does increase code size more noticeably
> > (+71 KB in my measurements), since the check and out of line call is
> > replicated at each call site.
> >
> > This provides a generic release-side signal for contended locks,
> > allowing: correlation of lock holders with waiters and measurement of
> > contended hold times
> >
> > This RFC addressing the same visibility gap without introducing per-lock
> > instrumentation.
> >
> > If this tradeoff is acceptable, this could be a generic alternative to
> > lock-specific tracepoints.
> >
> > [1]: https://lore.kernel.org/all/51aad0415b78c5a39f2029722118fa01eac77538.1773858853.git.d@xxxxxxxxxxxx
>
> That submission has met a disappointing response.
>
> How should I proceed with this series "mm: zone lock tracepoint
> instrumentation"? It's not urgent so I'm inclined to put this on hold
> while you pursue "locking: Add contended_release tracepoint to spinning
> locks"?

Thanks for the follow-up, Andrew.

My current plan is to focus on the "locking: Add contended_release
tracepoint to spinning locks" work and drive it to a clear conclusion:
either by getting feedback that it's not a good direction, or by getting
it into mainline.

In the meantime, it seems reasonable to drop the "mm: zone lock
tracepoint instrumentation" patchset from mm-new to avoid confusion
until the direction is clearer. I can revisit and respin it if the more
generic locking approach doesn't pan out.

>
> Please send that v2 sometime and hopefully Steven can help push it along?

I'll send the next version of the generic locking series soon. Any help
in pushing it along would be appreciated.