[PATCH v8 10/58] perf evsel: Add reference count

Namhyung Kim namhyung at kernel.org
Wed Apr 29 00:33:46 PDT 2026


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

Thanks,
Namhyung



More information about the linux-arm-kernel mailing list