From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752047AbcFWBaX (ORCPT ); Wed, 22 Jun 2016 21:30:23 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:48648 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751713AbcFWBaU (ORCPT ); Wed, 22 Jun 2016 21:30:20 -0400 Subject: Re: [PATCH v9 1/8] perf evlist: Introduce aux evlist To: Arnaldo Carvalho de Melo References: <1466586531-89751-1-git-send-email-wangnan0@huawei.com> <1466586531-89751-2-git-send-email-wangnan0@huawei.com> <20160622134051.GI4213@kernel.org> CC: Nilay Vaish , Linux Kernel list , , He Kuang , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , Zefan Li From: "Wangnan (F)" Message-ID: <576B3B95.8050105@huawei.com> Date: Thu, 23 Jun 2016 09:29:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160622134051.GI4213@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.576B3BA9.0145,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7079e25e2a688413f882bf239c12eee0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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.