Re: [PATCH] perf lock contention: Fix spinlock and rwlock accounting

From: Arnaldo Carvalho de Melo
Date: Fri Aug 30 2024 - 16:47:38 EST


On Fri, Aug 30, 2024 at 08:51:43AM -0700, Namhyung Kim wrote:
> Hi Arnaldo,
>
> On Fri, Aug 30, 2024 at 6:23 AM Arnaldo Carvalho de Melo
> <acme@xxxxxxxxxx> wrote:
> >
> > On Tue, Aug 27, 2024 at 10:29:53PM -0700, Namhyung Kim wrote:
> > > The spinlock and rwlock use a single-element per-cpu array to track
> > > current locks due to performance reason. But this means the key is
> > > always available and it cannot simply account lock stats in the array
> > > because some of them are invalid.
> > >
> > > In fact, the contention_end() program in the BPF invalidates the entry
> > > by setting the 'lock' value to 0 instead of deleting the entry for the
> > > hashmap. So it should skip entries with the lock value of 0 in the
> > > account_end_timestamp().
> >
> > Thanks, applied to perf-tools-next,
>
> I think this can go to perf-tools instead.

I think I published it already, don't think this is a major problem tho,
we can make a note when submitting for v6.12 that there are a few
patches that are already mainline.

For the future, its interesting that when posting patches we inform the
intended branch where it should be applied, something like:

[PATCH perf-tools] ...

Or I can add something to my scripts to check if the patch is a
regression introduced in the current merge window...

- Arnaldo