Re: [PATCH v9 1/8] perf evlist: Introduce aux evlist

From: Arnaldo Carvalho de Melo
Date: Wed Jun 22 2016 - 09:41:24 EST


Em Wed, Jun 22, 2016 at 08:17:02AM -0500, Nilay Vaish escreveu:
> On 22 June 2016 at 04:08, Wang Nan <wangnan0@xxxxxxxxxx> wrote:
> > +struct perf_evlist *perf_evlist__new_aux(struct perf_evlist *parent)
> > +{
> > + struct perf_evlist *evlist;
> > +
> > + if (perf_evlist__is_aux(parent)) {
> > + pr_err("Internal error: create aux evlist from another aux evlist\n");
> > + return NULL;
> > + }
> > +
> > + evlist = zalloc(sizeof(*evlist));
> > + if (!evlist)
> > + return NULL;
> > +
> > + perf_evlist__init(evlist, parent->cpus, parent->threads);
> > + evlist->parent = parent->parent;
>
> A very minor suggestion. I think evlist->parent should be set to
> 'parent' and not 'parent->parent'. I agree the two values are equal,
> but setting to parent->parent just does not seem right.

I felt like that, thought I was missing something, which is always a bad
feeling when processing a patch... So, Wang, does that have some value
we are not seeing?

I thought about the possibility of adding an aux2 to an aux1 evlist and
that making aux2 have the same parent as aux1, but that is checked on
that pr_err() test...

- Arnaldo