Skip to content

Commit 16c1e83

Browse files
Yury Norovrafaeljw
authored andcommitted
cpufreq: optimize policy_is_shared()
The switch to cpumask_nth() over cpumask_weight(), as it may return earlier - as soon as the function counts the required number of CPUs. Signed-off-by: Yury Norov <ynorov@nvidia.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com> Link: https://patch.msgid.link/20260314192544.605914-1-ynorov@nvidia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 022eec2 commit 16c1e83

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/linux/cpufreq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static inline bool policy_is_inactive(struct cpufreq_policy *policy)
232232

233233
static inline bool policy_is_shared(struct cpufreq_policy *policy)
234234
{
235-
return cpumask_weight(policy->cpus) > 1;
235+
return cpumask_nth(1, policy->cpus) < nr_cpumask_bits;
236236
}
237237

238238
#ifdef CONFIG_CPU_FREQ

0 commit comments

Comments
 (0)