From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187AbdA3St1 (ORCPT ); Mon, 30 Jan 2017 13:49:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50988 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753949AbdA3StZ (ORCPT ); Mon, 30 Jan 2017 13:49:25 -0500 Date: Mon, 30 Jan 2017 19:49:22 +0100 From: Jiri Olsa To: Jan Stancek Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, mhiramat@kernel.org, rui.teng@linux.vnet.ibm.com, sukadev@linux.vnet.ibm.com Subject: Re: [PATCH] perf: fix topology test on systems with sparse CPUs Message-ID: <20170130184922.GD28444@krava> References: <290bf2031885722414cb1ae031869094a18b0580.1485794959.git.jstancek@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <290bf2031885722414cb1ae031869094a18b0580.1485794959.git.jstancek@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 30 Jan 2017 18:49:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 30, 2017 at 05:53:34PM +0100, Jan Stancek wrote: SNIP > diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c > index bb964e86b09d..0c2cae807a61 100644 > --- a/tools/perf/util/env.c > +++ b/tools/perf/util/env.c > @@ -60,29 +60,45 @@ int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]) > > int perf_env__read_cpu_topology_map(struct perf_env *env) > { > - int cpu, nr_cpus; > + int cpu, nr_cpus, i, err = 0; > + struct cpu_map *map; > > if (env->cpu != NULL) > return 0; > > - if (env->nr_cpus_avail == 0) > - env->nr_cpus_avail = sysconf(_SC_NPROCESSORS_CONF); > + map = cpu_map__new(NULL); could you please put comment in here, explaining that cpu_map__new(NULL) makes map with current online cpus thanks, jirka