lkml.org 
[lkml]   [2022]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 2/5] libperf: Propagate maps only if necessary
    From
    On 24/09/22 19:57, Namhyung Kim wrote:
    > The current code propagate evsel's cpu map settings to evlist when it's
    > added to an evlist. But the evlist->all_cpus and each evsel's cpus will
    > be updated in perf_evlist__set_maps() later. No need to do it before
    > evlist's cpus are set actually.
    >
    > Actually we discarded this intermediate all_cpus maps at the beginning
    > of perf_evlist__set_maps(). Let's not do this. It's only needed when
    > an evsel is added after the evlist cpu maps are set.

    That might not be true. Consider evlist__fix_hybrid_cpus() which fiddles
    with evsel->core.cpus and evsel->core.own_cpus after the evsel has been
    added to the evlist. It can also remove an evsel from the evlist.

    There might be other cases like that, but that was just one that stuck
    out.

    >
    > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    > ---
    > tools/lib/perf/evlist.c | 8 +++-----
    > 1 file changed, 3 insertions(+), 5 deletions(-)
    >
    > diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
    > index 187129652ab6..cc070c3a134d 100644
    > --- a/tools/lib/perf/evlist.c
    > +++ b/tools/lib/perf/evlist.c
    > @@ -67,10 +67,6 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
    > {
    > struct perf_evsel *evsel;
    >
    > - /* Recomputing all_cpus, so start with a blank slate. */
    > - perf_cpu_map__put(evlist->all_cpus);
    > - evlist->all_cpus = NULL;
    > -
    > perf_evlist__for_each_evsel(evlist, evsel)
    > __perf_evlist__propagate_maps(evlist, evsel);
    > }
    > @@ -81,7 +77,9 @@ void perf_evlist__add(struct perf_evlist *evlist,
    > evsel->idx = evlist->nr_entries;
    > list_add_tail(&evsel->node, &evlist->entries);
    > evlist->nr_entries += 1;
    > - __perf_evlist__propagate_maps(evlist, evsel);
    > +
    > + if (evlist->all_cpus)
    > + __perf_evlist__propagate_maps(evlist, evsel);
    > }
    >
    > void perf_evlist__remove(struct perf_evlist *evlist,

    \
     
     \ /
      Last update: 2022-09-27 09:07    [W:6.034 / U:0.584 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site