cpuidle: Use cpumask_intersects_and where applicable
PATCH RESEND 1/1 cpuidle: Use cpumask_intersects_and where applicable
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.
---
This is resend of the v1 series posted as independent patch
https://lore.kernel.org/all/[email protected]/#t
drivers/cpuidle/coupled.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpuidle/coupled.c +2 -2
@@ -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); }/**
Signature · 1 line
2.52.0
Quoted 27 lines · Shrikanth Hegde
cpumask_first_and_andreturns, usually the first CPU in the intersection of the three cpumasks. However, if the returned CPU is not used or only to check it againstnr_cpu_ids, that implies to check whether the three cpumasks have a bit in common. I.e usecpumask_intersects_and.
cpumask_first_and_anduses ffs on (addr1[idx] & addr2[idx] & addr3[idx]) whereascpumask_intersects_andchecks only
(addr1[idx] & addr2[idx] & addr3[idx]).So replace such an occurrence.
Reviewed-by Yury Norov <[email protected]>Signed-off-by Shrikanth Hegde <[email protected]>---
This is resend of the v1 series posted as independent patch
https://lore.kernel.org/all/[email protected]/#tdrivers/cpuidle/coupled.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/cpuidle/coupled.c +0
-0@@ -439,8 +439,8 @@ static int cpuidle_coupled_clear_pokes(int cpu)
drivers/cpuidle/coupled.c static int cpuidle_coupled_clear_pokes(int cpu)
Quoted 10 lines
drivers/cpuidle/coupled.c +2
-3static 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); }/** --
Applied as 7.5 material, thanks!