Received: by 10.223.164.202 with SMTP id h10csp536390wrb; Tue, 14 Nov 2017 05:44:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMbbVJKyeWaISLwW8a6/CeQ/AHRKpDwBDLw+GWeQRvrfUz1V3+W/m1ijsk88ee2jeFP3tDHU X-Received: by 10.84.217.80 with SMTP id e16mr3064173plj.373.1510667079264; Tue, 14 Nov 2017 05:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510667079; cv=none; d=google.com; s=arc-20160816; b=OcaaNu548EmWg5lXkA0ee8LVb59trAd23FAn3fGeNwmRSR7VC06B0ARo+0cG+gyAMr xW+EXU4hb+Zsix5r0kDGdR8u6becv0u/DkCThN0bmk294bmErqbB4YOoxlbhSW2lcqXV Caw9SylXyJXyDKtVtR0/BUbtyPxHaksq92aH5cCyKfEX3/Nqh4X6dBsGaFpo2Yq0L7wm Z81jyBeOKRxDdFDcb1vF5DFJ3KvyB3dP1yeLyIRoKHdiKhq0X7NrlUhGv12icaoGH2sk EHfwteLbQn8I7m03JWmTwyFcDLVPpLgrrNHM/hjc1rOCDvsu2/QS80wz8j+0CQfGMrRy 3C0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:references:in-reply-to:cc:to:from:subject :arc-authentication-results; bh=vmu8VS0aJe4dAD9jAL8FNyEk9hTFtwlZhSBn5/D5y7U=; b=cMPBm5BvwMwh0M6BOgvX96wVbwNqEXbq9jsjOkctB/Xs2OUJbE299OZS3U/ETz6MbN S5b2k/lemyY2myLzTDHHH31JWZZjtr5QSlKPTZ9fdi6Xqlco31RKLt56nOTUR6nx+pqz 37sPuMWFDrm8LlpRkb50xdYEKHAKJQBnLSZunZGoDSO5GrD7crGMVukvL3Jlf8ydnvZE V6H8hRUhwVKTekQnhTasYEeDdAHRHvRqWssmMVBWOHYWKjLr15UbxsPnIbYkAk4KIbJx C4JDyVSJXS1mGQWPIEVY+gCKMdGk6aRZe1K7nYPh+DO6JzfnzGhJh5xvPxMPwHGKC54G AtkQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4si5530441pfa.198.2017.11.14.05.44.25; Tue, 14 Nov 2017 05:44:39 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754796AbdKNMsQ (ORCPT + 88 others); Tue, 14 Nov 2017 07:48:16 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37494 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754706AbdKNMsC (ORCPT ); Tue, 14 Nov 2017 07:48:02 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAEChwBX104277 for ; Tue, 14 Nov 2017 07:48:02 -0500 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e80p4gdej-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 14 Nov 2017 07:48:01 -0500 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Nov 2017 07:48:01 -0500 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 14 Nov 2017 07:47:59 -0500 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAEClx8u44957738; Tue, 14 Nov 2017 12:47:59 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8DB3D124044; Tue, 14 Nov 2017 07:45:03 -0500 (EST) Received: from satheesh-thinkpad-t450.in.ibm.com (unknown [9.193.110.44]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id E1CE012403D; Tue, 14 Nov 2017 07:45:00 -0500 (EST) Subject: Re: [PATCH v3 1/2] perf/bench/numa: Add functions to detect sparse numa nodes From: Satheesh Rajendran To: "Naveen N. Rao" Cc: acme@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, srikar@linux.vnet.ibm.com, bala24@linux.vnet.ibm.com In-Reply-To: <20171031151453.pe2ef33hyjl6bcxo@naverao1-tp.localdomain> References: <855c8ed2d15135f2ac32105f60a745a4fd14036b.1503310062.git.sathnaga@linux.vnet.ibm.com> <20171031151453.pe2ef33hyjl6bcxo@naverao1-tp.localdomain> Content-Type: text/plain; charset="UTF-8" Date: Tue, 14 Nov 2017 18:17:46 +0530 Mime-Version: 1.0 X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17111412-0036-0000-0000-0000028BF96F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008065; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000240; SDB=6.00945732; UDB=6.00477315; IPR=6.00726029; BA=6.00005689; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018009; XFM=3.00000015; UTC=2017-11-14 12:48:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111412-0037-0000-0000-00004260C7E0 Message-Id: <1510663666.24275.41.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-14_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711140175 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Naveen,Thanks for detailed review, my comments inline. On Tue, 2017-10-31 at 20:44 +0530, Naveen N. Rao wrote: > Hi Satheesh, > > On 2017/08/21 10:15AM, sathnaga@linux.vnet.ibm.com wrote: > > > > From: Satheesh Rajendran > > > > Added functions 1) to get a count of all nodes that are exposed to > > userspace. These nodes could be memoryless cpu nodes or cpuless > > memory > > nodes, 2) to check given node is present and 3) to check given > > node has cpus > > > > This information can be used to handle sparse/discontiguous nodes. > > > > Cc: Arnaldo Carvalho de Melo > > Reviewed-by: Srikar Dronamraju > > Signed-off-by: Satheesh Rajendran > > Signed-off-by: Balamuruhan S > > --- > >  tools/perf/bench/numa.c | 44 > > ++++++++++++++++++++++++++++++++++++++++++++ > >  1 file changed, 44 insertions(+) > > > > diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c > > index 469d65b..2483174 100644 > > --- a/tools/perf/bench/numa.c > > +++ b/tools/perf/bench/numa.c > > @@ -215,6 +215,50 @@ static const char * const numa_usage[] = { > >   NULL > >  }; > > > > +/* > > + * To get number of numa nodes present. > > + */ > > +static int nr_numa_nodes(void) > > +{ > > + int i, nr_nodes = 0; > > + > > + for (i = 0; i < g->p.nr_nodes; i++) { > > + if (numa_bitmask_isbitset(numa_nodes_ptr, i)) > > + nr_nodes++; > > + } > > + > > + return nr_nodes; > > +} > > + > > +/*  > Please run patches through scripts/checkpatch.pl. There is a > trailing  > whitespace above... > Sure > > > > + * To check if given numa node is present. > > + */ > > +static int is_node_present(int node) > > +{ > > + return numa_bitmask_isbitset(numa_nodes_ptr, node); > > +} > > + > > +/* > > + * To check given numa node has cpus. > > + */ > > +static bool node_has_cpus(int node) > > +{ > > + struct bitmask *cpu = numa_allocate_cpumask(); > > + unsigned int i; > > + > > + if (cpu == NULL) > > + return false; /* lets fall back to nocpus safely > > */ > > + > > + if (numa_node_to_cpus(node, cpu) == 0) { > This can be simplified to: > if (cpu && !numa_node_to_cpus(node, cpu)) { > > > > > + for (i = 0; i < cpu->size; i++) { > > + if (numa_bitmask_isbitset(cpu, i)) > > + return true; > > + } > > + } > The indentation on those brackets look to be wrong. > Sure > > > > + > > + return false; > > +} > > + > More importantly, you've introduced few functions in this patch, but  > none of those are being used. This is not a useful way to split your  > patches. In fact, this hurts bisect since trying to build perf with > just  > this patch applied throws errors. > Sure, This can be merged to single patch, will do it in next version. > You seem to be addressing a few different issues related to perf > bench  > numa. You might want to split your patch based on the specific > issue(s)  > each change fixes. > > > - Naveen > > Regards, -Satheesh. > > > >  static cpu_set_t bind_to_cpu(int target_cpu) > >  { > >   cpu_set_t orig_mask, mask; From 1582786709302944039@xxx Tue Oct 31 15:17:13 +0000 2017 X-GM-THRID: 1576332506056657646 X-Gmail-Labels: Inbox,Category Forums