Re: [PATCH v1 0/5] perf cpumap: Correct for perf_cpu_map__merge()

From: Leo Yan
Date: Thu Oct 10 2024 - 11:57:29 EST


On 9/25/24 20:53, Leo Yan wrote:
perf_cpu_map__merge() has two arguments, 'orig' and 'other', as
described in its original comment:

"orig either gets freed and replaced with a new map, or reused
with no reference count change (similar to "realloc")
other has its reference count increased."

This causes confusion due to the different reference counting on the CPU
map objects, which complicates its usage and makes maintenance
difficult. We also discussed this in the email [1].

This patch series makes that a new CPU map is allocated for the
merging result, or the reference count is increased if an existing CPU
map is reused. This means that once perf_cpu_map__merge() is invoked,
the caller gains ownership of the resulting map and must release it
with perf_cpu_map__put().

Gentle ping ...

Thanks,
Leo