Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp111469pxb; Tue, 15 Feb 2022 09:23:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxPC3geHF0c0D+cPYdx18aV5aqOYneJCF68hu21csAXfGIlcV4drz6aQ2y4sWMLlhA4DXg X-Received: by 2002:a17:906:d283:: with SMTP id ay3mr71623ejb.249.1644945822726; Tue, 15 Feb 2022 09:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644945822; cv=none; d=google.com; s=arc-20160816; b=agIJKxRPmHS0U0SsWjGF9VUEaxjH3e2fv3HuBpFjMvr28vJmKGGpSVmxQHFFcF9WKK 6+o5yge/eknwSNyHGbSQyINI+7iJfzPF1ddpFXGIDfOudoddTvQn/bG3dZiyw3ufBW4E BcMA01yU/RmVZ2q4jXAMXhvITHmNxOkrY+two/iv1E1qnfWi99WVV1qikZXj21tup6MX NBDeAFEpOkHYe2wwk05KDZNPFqig1KopfCNNb6Hn0pCEsqiFBrZOtoxTiMNowj8Wer8W 3PFfVwbmbJoKMap2Mnm92JcJMEBAozqlJe3YevoYRQEigsQdwEj1XHBxKjI/tROzbbT5 ZLwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iRQsLM7FC6wmJYC3+kztfNpfiga3AoKAGorYFlel8/4=; b=fpEjRpewwsL4zFBYqU7rNotVRH/VX/P9tX1gdnByLaXmEH3oAAx8he87Ijg/qE/I+6 BVCC3FQGpKoSpTuo0CSzpU2IGpEi3mUdBuZ4JywUdct3V1vBw1PkNoQaVqz8lGpBaaJ1 qDRppI+KyyOCeZj0MAFQMmPyFzJN/uGdn9fkgeb562J3BHynzF3Qr1Uc+98IO8Ceff4M 1ESVJRXd86pMhUwJA+Jlhj5bjJovLCKFyvOMhN0j6YWcuUF2EDrfTFOex+RguGskpB3Y kaw5JoSmPufonj58TKmCU2+J4wHKfUo1SZ6kKufnIMWFXtRlRV0qwAYyNYN1hMfGkCIa KZHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NcGM22dS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3si15562912ejo.576.2022.02.15.09.23.14; Tue, 15 Feb 2022 09:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NcGM22dS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238651AbiBOOen (ORCPT + 99 others); Tue, 15 Feb 2022 09:34:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbiBOOem (ORCPT ); Tue, 15 Feb 2022 09:34:42 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C6610216F; Tue, 15 Feb 2022 06:34:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8B337CE200E; Tue, 15 Feb 2022 14:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD06C340EB; Tue, 15 Feb 2022 14:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644935666; bh=mUg2TmmDqG6AdurTXvq5gyO2FdCxW5AfJa3PFKAhnxw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NcGM22dSh4dPsTdb26zZJgkv9RFg+XbFsZSLkNlzte8J17a+btQYtiRNPnFyfbX8e uzlThkzymDL9AVB19//WDhoGfLQBLktX4HU9uE8wMmf+pTxdHwa/RsZ8OEWy7NtRV2 GmJ6OQrn4CiWBXZXFbbZwG1BBAdvak0gM4829BA29vU0Rq40jVezPGJ1aL5vzNbFlq HfAF4LJcOKGrpMecOOJYiW2ydQMIQykh+d3CjYU1rrbJ5vI1S37cSDxVMpj4RKQj/t PL0Ms+CaB19AS4Ym8IIjarsmR/Li7n3nEW5861LfOyNjJsQTwZHDPPYAER8kmGwLC0 2UORWZZ2UlNUA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id D29DD400FE; Tue, 15 Feb 2022 11:34:24 -0300 (-03) Date: Tue, 15 Feb 2022 11:34:24 -0300 From: Arnaldo Carvalho de Melo To: Yury Norov Cc: Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org Subject: Re: [PATCH 12/54] tools/perf: replace bitmap_weight with bitmap_empty where appropriate Message-ID: References: <20220123183925.1052919-1-yury.norov@gmail.com> <20220123183925.1052919-13-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220123183925.1052919-13-yury.norov@gmail.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sun, Jan 23, 2022 at 10:38:43AM -0800, Yury Norov escreveu: > Some code in builtin-c2c.c calls bitmap_weight() to check if any bit of > a given bitmap is set. It's better to use bitmap_empty() in that case > because bitmap_empty() stops traversing the bitmap as soon as it finds > first set bit, while bitmap_weight() counts all bits unconditionally. Thanks, applied. - Arnaldo > Signed-off-by: Yury Norov > --- > tools/perf/builtin-c2c.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c > index 77dd4afacca4..14f787c67140 100644 > --- a/tools/perf/builtin-c2c.c > +++ b/tools/perf/builtin-c2c.c > @@ -1080,7 +1080,7 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp, > bitmap_zero(set, c2c.cpus_cnt); > bitmap_and(set, c2c_he->cpuset, c2c.nodes[node], c2c.cpus_cnt); > > - if (!bitmap_weight(set, c2c.cpus_cnt)) { > + if (bitmap_empty(set, c2c.cpus_cnt)) { > if (c2c.node_info == 1) { > ret = scnprintf(hpp->buf, hpp->size, "%21s", " "); > advance_hpp(hpp, ret); > @@ -1944,7 +1944,7 @@ static int set_nodestr(struct c2c_hist_entry *c2c_he) > if (c2c_he->nodestr) > return 0; > > - if (bitmap_weight(c2c_he->nodeset, c2c.nodes_cnt)) { > + if (!bitmap_empty(c2c_he->nodeset, c2c.nodes_cnt)) { > len = bitmap_scnprintf(c2c_he->nodeset, c2c.nodes_cnt, > buf, sizeof(buf)); > } else { > -- > 2.30.2 -- - Arnaldo