[PATCH v8 10/58] perf evsel: Add reference count
Ian Rogers
irogers at google.com
Wed Apr 29 09:20:30 PDT 2026
On Wed, Apr 29, 2026 at 12:33 AM Namhyung Kim <namhyung at kernel.org> wrote:
>
> On Tue, Apr 28, 2026 at 12:18:15AM -0700, Ian Rogers wrote:
> > As with evlist this a no-op for most of the perf tool. The reference
> > count is set to 1 at allocation, the put will see the 1, decrement it
> > and perform the delete. The purpose for adding the reference count is
> > for the python code. Prior to this change the python code would clone
> > evsels, but this has issues if events are opened, etc. leading to
> > assertion failures. With a reference count the same evsel can be used
> > and the reference count incremented for the python usage. To not
> > change the python evsel API getset functions are added for the evsel
> > members, no set function is provided for size as it doesn't make sense
> > to alter this.
>
> Can we make the reference counting model simpler by just using evlist's
> refcount? Assuming python code generates no evsel from the shared
> evlist, can we just think evsels belong to an evlist and manage their
> lifetime together?
>
> Maybe I talked it to you already.. but I forgot the details. :-p
I agree that would make the lifetime management easier, but we already
exposed evsels as Python objects and the existing cloning approach
makes the code base more complex and divergent.
Thanks,
Ian
> Thanks,
> Namhyung
More information about the linux-arm-kernel
mailing list