Re: [PATCH v5 13/13] perf stat: Use affinity for enabling/disabling events

From: Andi Kleen
Date: Mon Nov 11 2019 - 11:50:32 EST


On Mon, Nov 11, 2019 at 03:04:15PM +0100, Jiri Olsa wrote:
> On Thu, Nov 07, 2019 at 10:16:46AM -0800, Andi Kleen wrote:
>
> SNIP
>
> > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> > index 33080f79b977..571bb102b432 100644
> > --- a/tools/perf/util/evlist.c
> > +++ b/tools/perf/util/evlist.c
> > @@ -378,11 +378,28 @@ bool evsel__cpu_iter_skip(struct evsel *ev, int cpu)
> > void evlist__disable(struct evlist *evlist)
> > {
> > struct evsel *pos;
> > + struct affinity affinity;
> > + int cpu, i;
>
> should we have the fallback to current code in here (and below) as well?
> also for reading/openning?

The return only happens when you're out of memory, when nothing
will work anyways.

-Andi

>
> jirka
>
> > +
> > + if (affinity__setup(&affinity) < 0)
> > + return;