Re: [PATCH 21/22] cpufreq: use cpumask_weight_gt() in policy_is_shared()

From: Viresh Kumar
Date: Tue May 10 2022 - 23:16:58 EST


On 10-05-22, 08:47, Yury Norov wrote:
> cpumask_weight_gt() is better than cpumask_weight() because it may
> return earlier depending on condition.
>
> CC: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> CC: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> CC: linux-pm@xxxxxxxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
> ---
> include/linux/cpufreq.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index d5595d57f4e5..865cc9e23518 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -214,7 +214,7 @@ static inline bool policy_is_inactive(struct cpufreq_policy *policy)
>
> static inline bool policy_is_shared(struct cpufreq_policy *policy)
> {
> - return cpumask_weight(policy->cpus) > 1;
> + return cpumask_weight_gt(policy->cpus, 1);
> }
>
> #ifdef CONFIG_CPU_FREQ

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

Though the patch to add cpumask_weight_gt() is still in linux-next and so this
patch should get merged after rc1 is out.

And it would have been nice to know of this dependency in the original mail
itself instead of me searching for it :)

--
viresh