mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: linux-kernel@vger.kernel.org, sudeep.holla@kernel.org,
	gregkh@linuxfoundation.org
Cc: sshegde@linux.ibm.com, yury.norov@gmail.com,
	Yury Norov <ynorov@nvidia.com>
Subject: [PATCH RESEND] arch_topology: Use cpumask_intersects where applicable
Date: Tue, 17 Nov 2026 20:39:11 +0530	[thread overview]
Message-ID: <20261117150911.730754-1-sshegde@linux.ibm.com> (raw)

Looping over one cpumask and checking if any bit is set in another
cpumask is same as evaluating if two cpumasks intersects or not.

So use cpumask_intersects instead. It is probably faster too.

Reviewed-by: Yury Norov <ynorov@nvidia.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
This is resend of the v1 series posted as independent patch.
https://lore.kernel.org/all/20261111075945.3930230-1-sshegde@linux.ibm.com/

 drivers/base/arch_topology.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 8c5e47c28d9a..aba86e9c2516 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -34,14 +34,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(capacity_freq_ref);
 
 static bool supports_scale_freq_counters(const struct cpumask *cpus)
 {
-	int i;
-
-	for_each_cpu(i, cpus) {
-		if (cpumask_test_cpu(i, &scale_freq_counters_mask))
-			return true;
-	}
-
-	return false;
+	return cpumask_intersects(cpus, &scale_freq_counters_mask);
 }
 
 bool topology_scale_freq_invariant(void)
-- 
2.52.0


                 reply	other threads:[~2026-11-17 15:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117150911.730754-1-sshegde@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.holla@kernel.org \
    --cc=ynorov@nvidia.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®