Re: [PATCH 04/11] perf test: Fix cpu and thread map leaks in sw_clock_freq test

From: Jiri Olsa
Date: Tue Mar 02 2021 - 11:07:10 EST


On Tue, Mar 02, 2021 at 10:50:15AM +0900, Namhyung Kim wrote:

SNIP

> > > err = -ENOMEM;
> > > pr_debug("Not enough memory to create thread/cpu maps\n");
> > > - goto out_free_maps;
> > > + goto out_delete_evlist;
> > > }
> > >
> > > perf_evlist__set_maps(&evlist->core, cpus, threads);
> > >
> > > - cpus = NULL;
> > > - threads = NULL;
> >
> > hum, so IIUC we added these and the other you remove in your patches long time ago,
> > because there was no refcounting at that time, right?
>
> It seems my original patch just set the maps directly.
>
> bc96b361cbf9 perf tests: Add a test case for checking sw clock event frequency
>
> And after that Adrian changed it to use the set_maps() helper.
>
> c5e6bd2ed3e8 perf tests: Fix software clock events test setting maps

ok, and after that there's this one:
a55e56637613 perf evlist: Reference count the cpu and thread maps at set_maps()

forcing the get calls when storing cpus and threads

for the patchset

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

thanks,
jirka

>
> It seems we already had the refcounting at the moment. And then the libperf
> renaming happened later.
>
> Thanks,
> Namhyung
>