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

From: Jiri Olsa
Date: Mon Nov 11 2019 - 15:07:06 EST


On Mon, Nov 11, 2019 at 08:50:28AM -0800, Andi Kleen wrote:
> 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.

then let's have some assert or BUG_ON on !all_cpus
and remove the fallback code from close path

jirka

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