Received: by 10.223.164.221 with SMTP id h29csp4023885wrb; Tue, 31 Oct 2017 08:29:35 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TeOz9pBgyQQ6E+seFlGWbZq0PEb8jdScAQWKlJ5Ag92e29rRkcxrs2/1HmrJAVX/9pDWoy X-Received: by 10.101.81.198 with SMTP id i6mr2168191pgq.391.1509463775132; Tue, 31 Oct 2017 08:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509463775; cv=none; d=google.com; s=arc-20160816; b=BmVPcfYChSTkQZuIWHX6Xp27giRWoHpjoFdyByPaB1GG2FaVWpuC5YkYaZ21bsffwx xKirzkw5UjCdvLHScVj4+0nSXSeNtoO/LiFc2ULaIjzmWNJP1xMypmsVtznQDc9tVjkA oPDgucZalN/FwCtg+rZ0EXQ4ycms+0HJQfX2QEj2jt6KeTBfRlWWJd7x0+GhoTgTnSJ1 +CwAohruBs3vSQWRYmZ/tOHlNtGijfafuzwZmZn4eijnhTdl1CPtmOWGKyXpbYhoKVsx ScmWR9X+H0yrnxThsYItTkP83RZoW9xDESa4axOHIN7otc/o6dP7IjmTSLJlkg7gc32E Cfpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=5MP0ksoOjZe9LwIcAd00FmSGv4kiVjNO3WHl8thPJEk=; b=MnBy8A1Q2S8t/ciZO2zOJZQlI++Zk9IjTkIUpKYdpEJZqddpS+vVa5LRV77WjcMk1E wAj5Ru/aJlX+bYBy/4Ol2v5hQ8AJLWj4C43Wz2vKjutySg4xehb4nMO/ikZ9EANG19SQ CS4VnTpL0Lk6CzL2Pfpi/KpxGSYhMiAcKkoRtYyyRhvEZ5WTAoQuonNimU6vm2BoSTNf V0kgD5k/hir9At76jGlDHZeU1OnfjTgbcfkjCQ8GvHFf7yCHQrQ1S9qmFZPYbT6zuu/w TTq5yjh3edx50UkioL3qG/3SnlnOXH32YBPeENCbBmeoMO7yJyDRzYfw1WFoVOQxNlQF 5qdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y62si1766033pgb.545.2017.10.31.08.29.21; Tue, 31 Oct 2017 08:29:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753677AbdJaP1C (ORCPT + 99 others); Tue, 31 Oct 2017 11:27:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:33826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753654AbdJaP1B (ORCPT ); Tue, 31 Oct 2017 11:27:01 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 451D62190B; Tue, 31 Oct 2017 15:27:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 451D62190B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Received: by jouet.infradead.org (Postfix, from userid 1000) id 22D7E14001E; Tue, 31 Oct 2017 12:26:58 -0300 (-03) Date: Tue, 31 Oct 2017 12:26:57 -0300 From: Arnaldo Carvalho de Melo To: "Naveen N. Rao" Cc: sathnaga@linux.vnet.ibm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, srikar@linux.vnet.ibm.com, bala24@linux.vnet.ibm.com Subject: Re: [PATCH v3 2/2] perf/bench/numa: Handle discontiguous/sparse numa nodes Message-ID: <20171031152657.GU7045@kernel.org> References: <67b88aa2de6dd199d57bacdecf35d26958780feb.1503310062.git.sathnaga@linux.vnet.ibm.com> <20171031151658.clq6qmdfw3gj6afg@naverao1-tp.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171031151658.clq6qmdfw3gj6afg@naverao1-tp.localdomain> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Oct 31, 2017 at 08:46:58PM +0530, Naveen N. Rao escreveu: > On 2017/08/21 10:17AM, sathnaga@linux.vnet.ibm.com wrote: > > From: Satheesh Rajendran > > > > Certain systems are designed to have sparse/discontiguous nodes. > > On such systems, perf bench numa hangs, shows wrong number of nodes > > and shows values for non-existent nodes. Handle this by only > > taking nodes that are exposed by kernel to userspace. > > > > Cc: Arnaldo Carvalho de Melo > > Reviewed-by: Srikar Dronamraju > > Signed-off-by: Satheesh Rajendran > > Signed-off-by: Balamuruhan S > > --- > > tools/perf/bench/numa.c | 17 ++++++++++------- > > 1 file changed, 10 insertions(+), 7 deletions(-) > > > > diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c > > index 2483174..d4cccc4 100644 > > --- a/tools/perf/bench/numa.c > > +++ b/tools/perf/bench/numa.c > > @@ -287,12 +287,12 @@ static cpu_set_t bind_to_cpu(int target_cpu) > > > > static cpu_set_t bind_to_node(int target_node) > > { > > - int cpus_per_node = g->p.nr_cpus/g->p.nr_nodes; > > + int cpus_per_node = g->p.nr_cpus/nr_numa_nodes(); > > cpu_set_t orig_mask, mask; > > int cpu; > > int ret; > > > > - BUG_ON(cpus_per_node*g->p.nr_nodes != g->p.nr_cpus); > > + BUG_ON(cpus_per_node*nr_numa_nodes() != g->p.nr_cpus); > > BUG_ON(!cpus_per_node); > > > > ret = sched_getaffinity(0, sizeof(orig_mask), &orig_mask); > > @@ -692,7 +692,7 @@ static int parse_setup_node_list(void) > > int i; > > > > for (i = 0; i < mul; i++) { > > - if (t >= g->p.nr_tasks) { > > + if (t >= g->p.nr_tasks || !node_has_cpus(bind_node)) { > > printf("\n# NOTE: ignoring bind NODEs starting at NODE#%d\n", bind_node); > > goto out; > > } > > @@ -973,6 +973,7 @@ static void calc_convergence(double runtime_ns_max, double *convergence) > > int node; > > int cpu; > > int t; > > + int processes; > > > > if (!g->p.show_convergence && !g->p.measure_convergence) > > return; > > @@ -1007,13 +1008,14 @@ static void calc_convergence(double runtime_ns_max, double *convergence) > > sum = 0; > > > > for (node = 0; node < g->p.nr_nodes; node++) { > > + if (!is_node_present(node)) > > + continue; > > nr = nodes[node]; > > nr_min = min(nr, nr_min); > > nr_max = max(nr, nr_max); > > sum += nr; > > } > > BUG_ON(nr_min > nr_max); > > - > > Looks like an un-necessary change there. Right, and I would leave the 'int processes' declaration where it is, as it is not used outside that loop. The move of that declaration to the top of the calc_convergence() function made me spend some cycles trying to figure out why that was done, only to realize that it was an unnecessary change :-\ > - Naveen > > > BUG_ON(sum > g->p.nr_tasks); > > > > if (0 && (sum < g->p.nr_tasks)) > > @@ -1027,8 +1029,9 @@ static void calc_convergence(double runtime_ns_max, double *convergence) > > process_groups = 0; > > > > for (node = 0; node < g->p.nr_nodes; node++) { > > - int processes = count_node_processes(node); > > - > > + if (!is_node_present(node)) > > + continue; > > + processes = count_node_processes(node); > > nr = nodes[node]; > > tprintf(" %2d/%-2d", nr, processes); > > > > @@ -1334,7 +1337,7 @@ static void print_summary(void) > > > > printf("\n ###\n"); > > printf(" # %d %s will execute (on %d nodes, %d CPUs):\n", > > - g->p.nr_tasks, g->p.nr_tasks == 1 ? "task" : "tasks", g->p.nr_nodes, g->p.nr_cpus); > > + g->p.nr_tasks, g->p.nr_tasks == 1 ? "task" : "tasks", nr_numa_nodes(), g->p.nr_cpus); > > printf(" # %5dx %5ldMB global shared mem operations\n", > > g->p.nr_loops, g->p.bytes_global/1024/1024); > > printf(" # %5dx %5ldMB process shared mem operations\n", From 1582786757574011873@xxx Tue Oct 31 15:17:59 +0000 2017 X-GM-THRID: 1576332437617451512 X-Gmail-Labels: Inbox,Category Forums