From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752929Ab3K0Jgp (ORCPT ); Wed, 27 Nov 2013 04:36:45 -0500 Received: from mga02.intel.com ([134.134.136.20]:24723 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515Ab3K0Jgl (ORCPT ); Wed, 27 Nov 2013 04:36:41 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,781,1378882800"; d="scan'208";a="415828258" Message-ID: <5295BEDA.5070002@intel.com> Date: Wed, 27 Nov 2013 11:43:54 +0200 From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Dongsheng Yang CC: linux-kernel@vger.kernel.org, dsahern@gmail.com, jolsa@redhat.com, namhyung@kernel.org, acme@ghostprotocols.net, mingo@redhat.com Subject: Re: [PATCH] perf util: Join four conditions in two in perf_evlist__create_maps(). References: <1385590984-30244-1-git-send-email-yangds.fnst@cn.fujitsu.com> In-Reply-To: <1385590984-30244-1-git-send-email-yangds.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/11/13 00:23, Dongsheng Yang wrote: > There are four condition branchs in perf_evlist__create_maps, but they > only do two kinds of thing. 1st and 4th call cpu_map__new(), and the others > call cpu_map__dummy_new(). This patch joins them in two branchs, decreasing > the number of branch and removing some duplicated code. That code has changed again. See: http://git.kernel.org/cgit/linux/kernel/git/acme/linux.git/log/?h=perf/core > > Signed-off-by: Dongsheng Yang > --- > tools/perf/util/evlist.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c > index bbc746a..2258eb4 100644 > --- a/tools/perf/util/evlist.c > +++ b/tools/perf/util/evlist.c > @@ -819,11 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) > if (evlist->threads == NULL) > return -1; > > - if (target->force_per_cpu) > - evlist->cpus = cpu_map__new(target->cpu_list); > - else if (target__has_task(target)) > - evlist->cpus = cpu_map__dummy_new(); > - else if (!target__has_cpu(target) && !target->uses_mmap) > + if (!target->force_per_cpu && > + (target__has_task(target) || > + (!target__has_cpu(target) && !target->uses_mmap))) > evlist->cpus = cpu_map__dummy_new(); > else > evlist->cpus = cpu_map__new(target->cpu_list); >