Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1271683pxa; Thu, 13 Aug 2020 05:10:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPn0eHLsZsoQwrXAAXaC2ujQSDaTnD1F19fgKxR1CHDy/F8zbkMp4fMeOovQRc6yucyESe X-Received: by 2002:a50:af86:: with SMTP id h6mr4486053edd.132.1597320621763; Thu, 13 Aug 2020 05:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597320621; cv=none; d=google.com; s=arc-20160816; b=h6Fo3ltGtEWHesHsHycWHFAIhPxXHOGtnaiWkK3nk4E1pznPD7R30QPMf+7n5l5AHD N/dOtQBs0f3EF6HZLTY610lyHSLKKv1uNCPeYFH4rVT/H27SQv1Vwga+FvXexzFjdmir A5dlbRXiLQvUzgzv8WZjT5pHSimQXtVdYCce3lizV75mew1QTNVzn4dwhoE62ESNv8hy RdsHF2uiMFPb1hTPk4kQmnkkxNWIg4jZnAgJyxjvHU9CZzvR0YOIlzddT4ARw2m/MxQA ZB6U10kIGQjupTiUn+aRLETOYWBG/n1IByXWqE/sVyAw0D06Vguw2HwNSEpGREIHYBwC 4hXg== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=LLTLmBewyqkmKqJHV+bmHLRkwhbhcqH5K4GI6AqMyKc=; b=f+qZNlHSBhLAuJlZts54a1YR1MjC6xeAAKSEMqDSqSb3xNJYYwPjUUMXt3gpX9sXBe JkAFqxcH1jQRWsA2+Kmbc2O8o9W6a5ToTW8+ZtLEqgmakNzELqf6m+bXKwj8c8EbyOmR pan0CVXIXeT36YEE7MwESq5AaKms0M189/+ofY8hSucs808d9TG+ovy3QaUFK1CjhTXW oN5wCRZH7CiLFJ3zfrUtfjoaUncJU3pCi+xx74FBDfVDSBabITa1zQ6qq3O1wxRaGx+n Ute027hNK2wUvnLc5pjlQWd+Ls/95tCO4E1JHNx5U5B1lCyaNZoF9WMOQgH6kX8QPUFj Mhsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KjWPyd5C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n16si3065987ejj.284.2020.08.13.05.09.57; Thu, 13 Aug 2020 05:10:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KjWPyd5C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbgHMMHN (ORCPT + 99 others); Thu, 13 Aug 2020 08:07:13 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45704 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbgHMMHK (ORCPT ); Thu, 13 Aug 2020 08:07:10 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07DC3SOo172399; Thu, 13 Aug 2020 08:06:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : reply-to : references : mime-version : content-type : in-reply-to; s=pp1; bh=LLTLmBewyqkmKqJHV+bmHLRkwhbhcqH5K4GI6AqMyKc=; b=KjWPyd5CtwAyA6UcnDIXaE3A4gvVaIupM1W4Yeg4lB6F3eR6qb08kMT1FPmpafmCIebW OI2XhtekOto522iVcH+cCVdd6sWFDdn6Y3vEzBTdhudmlu/Z+j+Idb6b2fHMSW2bEtB+ gBsocRqTXFAx8W0bTixx8LhowN2Pu9o56K6hSqnEkA2SbFHMaBfssnM3K/vlCHXDUKVO 5kdARjk23ERQPITyXs1SkuLcz/QRQc1g4e3wai5MnLMSo8jod5MfxhLLe7gP6qJq1Vob sAw6WjIyvw9kPzi5M9IlNrQUbc8ZIbwc2VR3tzEWlblaHY1+5kAUAJE16zHns207D0OU iw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32vqqcwjm2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Aug 2020 08:06:57 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07DC6obB187753; Thu, 13 Aug 2020 08:06:57 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 32vqqcwjjp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Aug 2020 08:06:57 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07DC6I6P030673; Thu, 13 Aug 2020 12:06:54 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 32skp85h4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Aug 2020 12:06:54 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07DC6qYB42598760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Aug 2020 12:06:52 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 239EE4204D; Thu, 13 Aug 2020 12:06:52 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 004F042045; Thu, 13 Aug 2020 12:06:50 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by d06av24.portsmouth.uk.ibm.com (Postfix) with SMTP; Thu, 13 Aug 2020 12:06:49 +0000 (GMT) Date: Thu, 13 Aug 2020 17:36:49 +0530 From: Srikar Dronamraju To: Alexander Gordeev Cc: Namhyung Kim , Arnaldo Carvalho de Melo , linux-kernel , Satheesh Rajendran , "Naveen N. Rao" , Balamuruhan S , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa Subject: Re: [PATCH v3 1/2] perf bench numa: fix cpumask memory leak in node_has_cpus() Message-ID: <20200813120649.GA21578@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20200813113041.GA1685@oc3871087118.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20200813113041.GA1685@oc3871087118.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-13_10:2020-08-13,2020-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 impostorscore=0 suspectscore=2 adultscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008130092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Alexander Gordeev [2020-08-13 13:30:42]: > Couple numa_allocate_cpumask() and numa_free_cpumask() functions > > Signed-off-by: Alexander Gordeev > --- > tools/perf/bench/numa.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c > index 31e2601..9066511 100644 > --- a/tools/perf/bench/numa.c > +++ b/tools/perf/bench/numa.c > @@ -248,16 +248,21 @@ static int is_node_present(int node) > static bool node_has_cpus(int node) > { > struct bitmask *cpu = numa_allocate_cpumask(); > + bool ret = false; /* fall back to nocpus */ > unsigned int i; > > - if (cpu && !numa_node_to_cpus(node, cpu)) { > + BUG_ON(!cpu); > + if (!numa_node_to_cpus(node, cpu)) { > for (i = 0; i < cpu->size; i++) { > - if (numa_bitmask_isbitset(cpu, i)) > - return true; > + if (numa_bitmask_isbitset(cpu, i)) { > + ret = true; > + break; > + } > } > } > + numa_free_cpumask(cpu); > > - return false; /* lets fall back to nocpus safely */ > + return ret; > } > > static cpu_set_t bind_to_cpu(int target_cpu) > -- > 1.8.3.1 > Looks good to me. Reviewed-by: Srikar Dronamraju -- Thanks and Regards Srikar Dronamraju