From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2A35C433F5 for ; Fri, 11 Feb 2022 10:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348899AbiBKKbB (ORCPT ); Fri, 11 Feb 2022 05:31:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234309AbiBKKaw (ORCPT ); Fri, 11 Feb 2022 05:30:52 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4EB2E88 for ; Fri, 11 Feb 2022 02:30:49 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A081D106F; Fri, 11 Feb 2022 02:30:49 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.87.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D08C3F73B; Fri, 11 Feb 2022 02:30:44 -0800 (PST) Date: Fri, 11 Feb 2022 10:30:37 +0000 From: Mark Rutland To: Yury Norov , Will Deacon 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, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 33/49] perf: replace bitmap_weight with bitmap_weight_eq for ThunderX2 Message-ID: References: <20220210224933.379149-1-yury.norov@gmail.com> <20220210224933.379149-34-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210224933.379149-34-yury.norov@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 10, 2022 at 02:49:17PM -0800, Yury Norov wrote: > tx2_uncore_event_start() calls bitmap_weight() to compare the weight > of bitmap with a given number. We can do it more efficiently with > bitmap_weight_eq because conditional bitmap_weight may stop traversing > the bitmap earlier, as soon as condition is (or can't be) met. > > Signed-off-by: Yury Norov Given the max counters value is either 4 or 8 I doubt this should matter, but for consistenct this is fine, so: Acked-by: Mark Rutland I now see bitmap_weight_eq() is introduced within this series, so I assume you need to queue that and its users together, and will want to take the prior drivers/perf/ bit together with that. Thanks, Mark. > --- > drivers/perf/thunderx2_pmu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c > index 1edb9c03704f..97d5b39778fa 100644 > --- a/drivers/perf/thunderx2_pmu.c > +++ b/drivers/perf/thunderx2_pmu.c > @@ -623,8 +623,8 @@ static void tx2_uncore_event_start(struct perf_event *event, int flags) > return; > > /* Start timer for first event */ > - if (bitmap_weight(tx2_pmu->active_counters, > - tx2_pmu->max_counters) == 1) { > + if (bitmap_weight_eq(tx2_pmu->active_counters, > + tx2_pmu->max_counters, 1)) { > hrtimer_start(&tx2_pmu->hrtimer, > ns_to_ktime(tx2_pmu->hrtimer_interval), > HRTIMER_MODE_REL_PINNED); > -- > 2.32.0 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3FC7AC433F5 for ; Fri, 11 Feb 2022 10:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KRnbc7ytpIn64dJesYNPwEgiSxi2xeDY7+vTQqU+AZ4=; b=3mSDx4D1M+BpCD MP5Lpz3ZjUTj/qww1t0CEeqDPeFFuyPw/3LNwfUnNhFPBOf7T8tLmlb5a76dveyxq65aMFsyzxGAb /EK0Gv+E2s0BmbNgxXXrLT0noaE7LwqqpPAj8gFONzCllj0G9xrIeEnBsOjU/RiRzdEFFvep22Soa r5PAUllLW0UcbuPQNBr6+OQG1XiGoGtU2ScpmybOVszxzUHUwDK8x9uIbT7xwVO4pBlSnfcbd+eYC QScVjftxWrjtU1HJcPNj+QNYb8gfWn4DTtwftC7A5LXoEH0ClLGM+l6BnLBZX2ORvcFf2MWsLVRrS i/yXkMWqU7fmLoyQIrWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nITCY-006Z0i-8r; Fri, 11 Feb 2022 10:30:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nITCV-006Z04-A7 for linux-arm-kernel@lists.infradead.org; Fri, 11 Feb 2022 10:30:52 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A081D106F; Fri, 11 Feb 2022 02:30:49 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.87.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D08C3F73B; Fri, 11 Feb 2022 02:30:44 -0800 (PST) Date: Fri, 11 Feb 2022 10:30:37 +0000 From: Mark Rutland To: Yury Norov , Will Deacon 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, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 33/49] perf: replace bitmap_weight with bitmap_weight_eq for ThunderX2 Message-ID: References: <20220210224933.379149-1-yury.norov@gmail.com> <20220210224933.379149-34-yury.norov@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220210224933.379149-34-yury.norov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220211_023051_404303_711F2B56 X-CRM114-Status: GOOD ( 18.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 10, 2022 at 02:49:17PM -0800, Yury Norov wrote: > tx2_uncore_event_start() calls bitmap_weight() to compare the weight > of bitmap with a given number. We can do it more efficiently with > bitmap_weight_eq because conditional bitmap_weight may stop traversing > the bitmap earlier, as soon as condition is (or can't be) met. > > Signed-off-by: Yury Norov Given the max counters value is either 4 or 8 I doubt this should matter, but for consistenct this is fine, so: Acked-by: Mark Rutland I now see bitmap_weight_eq() is introduced within this series, so I assume you need to queue that and its users together, and will want to take the prior drivers/perf/ bit together with that. Thanks, Mark. > --- > drivers/perf/thunderx2_pmu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c > index 1edb9c03704f..97d5b39778fa 100644 > --- a/drivers/perf/thunderx2_pmu.c > +++ b/drivers/perf/thunderx2_pmu.c > @@ -623,8 +623,8 @@ static void tx2_uncore_event_start(struct perf_event *event, int flags) > return; > > /* Start timer for first event */ > - if (bitmap_weight(tx2_pmu->active_counters, > - tx2_pmu->max_counters) == 1) { > + if (bitmap_weight_eq(tx2_pmu->active_counters, > + tx2_pmu->max_counters, 1)) { > hrtimer_start(&tx2_pmu->hrtimer, > ns_to_ktime(tx2_pmu->hrtimer_interval), > HRTIMER_MODE_REL_PINNED); > -- > 2.32.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel