Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3175806pxb; Mon, 24 Jan 2022 04:15:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjeDucoGKc0wEmG2C3B9sq4g55iXr+XRH0cv0dm06cTebLBbpwcm7zb0xszWrJDcE0KBya X-Received: by 2002:aa7:90d4:0:b0:4bd:b258:e872 with SMTP id k20-20020aa790d4000000b004bdb258e872mr13585712pfk.46.1643026517482; Mon, 24 Jan 2022 04:15:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643026517; cv=none; d=google.com; s=arc-20160816; b=fMGN0nk/cy9ty62KMKlBXw0ENz92/0tcNllnTAQFQVRXOmebtuB4HqgQwd3M9cvfhP nOJs8qPjFOrEKcfJVFVW1xbgZWLd2Q7JIif/CGnm0rCSAephojSGL597Ogvpp348fzfV d3nKZ095idLeHauNEiUpXxHNLyiKVIdpidqRGTkEkBlq6RseF8CB2QskbEMFsqzeAAr4 wgVcQVxuKTvYKgBjD+L0P+vtC6SBZt9IWIeNt/r8Y8BkIhJ2KnIR5J2Msj6FA5JaOBgv 75NpEprutLYIpkiGXfCOW95HxR11iG5EzxEb6gIXPPjAThfNLdVydMDO4dDAXCeQ+oYj BvYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=T5W4tcAlu9II6TGKyllSre1cwbBZX0+vG2XX1glXT5Y=; b=ZuxL89HjpH8FajwxB5GfRilXb8OPcLVvhTK59RkbG0nlr4BreOAjlstjzAtPnfqf4n DY1yVn1Mj8RQJDbCDgKqsUZc6vHEcQ65uLstXT9jsFBXOEK45W/vK4wdnKqbu3V6sgEl sLtCBmpAEa+Y/nwGZdGnKF2pVgY2GwE+y7fAm4+7qZe3IIhK70P2i1rRJ9N5/DifN9C8 Fn5cqA6NCf8lQyKCkAzLoCheiDTWXkFx9j9gvwIGrUsBccNiI54d5HAoedVs9tRdy79z RnZ4G+iiJFZkhlAZoIznsLqG1hvemFT894StiXlQZTCjGddSxqffvSWhuy43tHWphtcT 0VlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VC3JAELl; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si12991567pgw.189.2022.01.24.04.15.05; Mon, 24 Jan 2022 04:15:17 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=VC3JAELl; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240024AbiAWSm3 (ORCPT + 99 others); Sun, 23 Jan 2022 13:42:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239866AbiAWSlf (ORCPT ); Sun, 23 Jan 2022 13:41:35 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EDAEC061771 for ; Sun, 23 Jan 2022 10:41:35 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id e28so9333233pfj.5 for ; Sun, 23 Jan 2022 10:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=T5W4tcAlu9II6TGKyllSre1cwbBZX0+vG2XX1glXT5Y=; b=VC3JAELl4Bcc9x72apcbabSCxL7VtVtW52zOXinf9qQcKr8OiQhjNNZMIrMJHzF88t PBbjx7GVOfENmdJpobQoYLoM0+q14MmtfuHhOG+fjHB0cOXMjZCKVaz6bk6JD+LNKC5B 5NUZ3S71+7ggjbktRx126GlRhxpUMjYhaZ2jbXFyzl5Lj7tIXclBHF9agDV7w5Qy9DhE XHds+SdkFGGW/BxKpgXgtqSdEdTmoAGhhKG9P7xJgfG1bWErw0ZgZPmTOwklfWyoaD2b xRSYuTXb3JFgXIhYF7+jekASh+2hU6RWDE3TB0a2Q1knyPegNCjOVKr8ZN8q72lZ8YSV A6cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T5W4tcAlu9II6TGKyllSre1cwbBZX0+vG2XX1glXT5Y=; b=sIiLreyopLGfEKUTqYsfLuClBnDPWFoou3+NSN0RBmaNstzRCuoG0tRENQSaGLBNAl wN2wtmNU1MiQq7K+c9u4XE9OrjPBX1sDuJaI0JgNRUDGa9dtT1RWyrQAcunONg0J0dyy kncWGBIa10zCX1FVnUs85mMpyn5K653BX+F42p9HvUojFkpRqIr6sl8ZJdpLbTBYm0Nn 9g+CyK3H/TXLDVmsxDY0QuJUkOAADJeXzW/uJSXSfUYXQxTBGWVL8ZFHjTZK39Z30Mro z9HyEUMR2/0/tZ81V6C6fe7JE3PZ/2vPoGRwOfXZ8SKWKgrTtPOX5rEzWVz3Z2Q9DMrO Bo0A== X-Gm-Message-State: AOAM532/ybak/HB8qBJqUYc2aAAj5ocpslZOWlBbtE3h8TcFA/Wz2pIE V9uTRETfX0LF/DlOB4Pd/Kk= X-Received: by 2002:a63:9347:: with SMTP id w7mr9366776pgm.84.1642963294566; Sun, 23 Jan 2022 10:41:34 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id k12sm14285241pfc.107.2022.01.23.10.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:34 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , 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, Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org Subject: [PATCH 34/54] perf: replace bitmap_weight with bitmap_weight_eq for ThunderX2 Date: Sun, 23 Jan 2022 10:39:05 -0800 Message-Id: <20220123183925.1052919-35-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 met. Signed-off-by: Yury Norov --- 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 05378c0fd8f3..ebfa66b212c7 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.30.2