Re: [PATCH v4 0/5] mm: zone lock tracepoint instrumentation
From: Matthew Wilcox
Date: Mon Mar 09 2026 - 10:47:58 EST
On Mon, Mar 09, 2026 at 02:21:42PM +0000, Dmitry Ilvokhin wrote:
> On Mon, Mar 09, 2026 at 01:10:46PM +0000, Matthew Wilcox wrote:
> > On Fri, Feb 27, 2026 at 04:00:22PM +0000, Dmitry Ilvokhin wrote:
> > > This patch series adds dedicated tracepoint instrumentation to
> > > zone lock, following the existing mmap_lock tracing model.
> >
> > I don't like this at all. We have CONFIG_LOCK_STAT. That should be
> > improved insted of coming up with one-offs for every single lock
> > that someone deems "special".
>
> Thanks for the feedback, Matthew.
>
> CONFIG_LOCK_STAT provides useful statistics, but it is primarily a
> debug facility and is generally too heavyweight for the production
> environments.
Yes, agreed. I think that is what needs to change.
> The motivation for this series was to provide lightweight observability
> for the zone lock in production workloads.
I read that. But first it was the mmap lock. Now it's the zone lock.
Which lock will be next? This is too heavyweight a procedure to
follow for each lock of interest.
> I agree that improving generic lock instrumentation would be preferable.
> I did consider whether something similar could be done generically for
> spinlocks, but the unlock path there is typically just a single atomic
> store, so adding generic lightweight instrumentation without affecting
> the fast path is difficult.
This is why we have tracepoint_enabled() and friends. But ... LOCK_STAT
doesn't affect the unlock path at all. It only changes the acquire side
to call lock_acquired() (and lock_contended() if the trylock failed).
> In parallel, I've been experimenting with improving observability for
> sleepable locks by adding a contended_release tracepoint, which would
> allow correlating lock holders and waiters in a more generic way. I've
> posted an RFC here:
>
> https://lore.kernel.org/all/cover.1772642407.git.d@xxxxxxxxxxxx/
>
> I'd appreciate feedback on whether that direction makes sense for
> improving the generic lock tracing infrastructure.
It seems fine to me, but I don't have the depth in the locking code to
give it the thorough review it deserves.