[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <576B3B95.8050105@huawei.com>
Date: Thu, 23 Jun 2016 09:29:57 +0800
From: "Wangnan (F)" <wangnan0@...wei.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
CC: Nilay Vaish <nilayvaish@...il.com>,
Linux Kernel list <linux-kernel@...r.kernel.org>,
<pi3orama@....com>, He Kuang <hekuang@...wei.com>,
Jiri Olsa <jolsa@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Zefan Li <lizefan@...wei.com>
Subject: Re: [PATCH v9 1/8] perf evlist: Introduce aux evlist
On 2016/6/22 21:40, Arnaldo Carvalho de Melo wrote:
> Em Wed, Jun 22, 2016 at 08:17:02AM -0500, Nilay Vaish escreveu:
>> On 22 June 2016 at 04:08, Wang Nan <wangnan0@...wei.com> 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...
The pr_err() test is added yesterday to emphasize we don't accept
grandchildren. Before we have this test, setting parent to parent->parent
is a defensive programming. And I think it is clever :)
Thank you.
Powered by blists - more mailing lists