[PATCH 2/5] cpu/hotplug: Use cpumask_intersects where applicable
From: Shrikanth Hegde
Date: Wed Nov 11 2026 - 03:01:07 EST
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>
---
kernel/cpu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 376d297a6292..e39245d9bffe 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;
}
--
2.52.0