[tip: sched/core] cpu/hotplug: Use cpumask_intersects where applicable

From: tip-bot2 for Shrikanth Hegde

Date: Wed Nov 18 2026 - 08:45:25 EST


The following commit has been merged into the sched/core branch of tip:

Commit-ID: 69465ca8f6b5d332e7996643664442a93be254b6
Gitweb: https://git.kernel.org/tip/69465ca8f6b5d332e7996643664442a93be254b6
Author: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
AuthorDate: Wed, 11 Nov 2026 13:29:42 +05:30
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Wed, 18 Nov 2026 14:32:20 +01:00

cpu/hotplug: Use cpumask_intersects where applicable

cpumask_any_and returns, usually the first cpu in the intersection
of the two cpumasks. However, if the returned value is not used or
only to check it against nr_cpu_ids, that implies whether the two
cpumask have a bit in common. i.e cpumask_intersects.

cpumask_any_and uses ffs on (addr1[idx] & addr2[idx]) whereas
cpumask_intersects checks only (addr1[idx] & addr2[idx]).

So replace such occurrences.

Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20261111075945.3930230-3-sshegde@xxxxxxxxxxxxx
---
kernel/cpu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 376d297..e39245d 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1418,8 +1418,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
* Keep at least one housekeeping cpu onlined to avoid generating
* an empty sched_domain span.
*/
- if (cpumask_any_and(cpu_online_mask,
- housekeeping_cpumask(HK_TYPE_DOMAIN)) >= nr_cpu_ids) {
+ if (!cpumask_intersects(cpu_online_mask, housekeeping_cpumask(HK_TYPE_DOMAIN))) {
ret = -EBUSY;
goto out;
}