Linux Power Management development
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: rafael@kernel.org, linux-pm@vger.kernel.org, daniel.lezcano@kernel.org
Cc: sshegde@linux.ibm.com, christian.loehle@arm.com,
	Yury Norov <ynorov@nvidia.com>
Subject: [PATCH RESEND] cpuidle: Use cpumask_intersects_and where applicable
Date: Tue, 17 Nov 2026 20:42:18 +0530	[thread overview]
Message-ID: <20261117151218.731219-1-sshegde@linux.ibm.com> (raw)

cpumask_first_and_and returns, usually the first CPU in the intersection
of the three cpumasks. However, if the returned CPU is not used or
only to check it against nr_cpu_ids, that implies to check whether the
three cpumasks have a bit in common. I.e use cpumask_intersects_and.

cpumask_first_and_and uses ffs on (addr1[idx] & addr2[idx] & addr3[idx])
whereas cpumask_intersects_and checks only
(addr1[idx] & addr2[idx] & addr3[idx]).

So replace such an occurrence.

Reviewed-by: Yury Norov <ynorov@nvidia.com>
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/#t

 drivers/cpuidle/coupled.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index fb91a9e0e3c2..40db5c86a466 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -439,8 +439,8 @@ static int cpuidle_coupled_clear_pokes(int cpu)
 
 static bool cpuidle_coupled_any_pokes_pending(struct cpuidle_coupled *coupled)
 {
-	return cpumask_first_and_and(cpu_online_mask, &coupled->coupled_cpus,
-				     &cpuidle_coupled_poke_pending) < nr_cpu_ids;
+	return cpumask_intersects_and(cpu_online_mask, &coupled->coupled_cpus,
+				      &cpuidle_coupled_poke_pending);
 }
 
 /**
-- 
2.52.0


                 reply	other threads:[~2026-11-17 15:12 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=20261117151218.731219-1-sshegde@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=christian.loehle@arm.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=ynorov@nvidia.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