Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/pmu: replace cpumask_weight with cpumask_empty where appropriate

i915_pmu_cpu_online() calls cpumask_weight() to check if any bit of a
given cpumask is set. We can do it more efficiently with cpumask_empty()
because cpumask_empty() stops traversing the cpumask as soon as it finds
first set bit, while cpumask_weight() counts all bits unconditionally.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

+1 -1
+1 -1
drivers/gpu/drm/i915/i915_pmu.c
··· 1050 1050 GEM_BUG_ON(!pmu->base.event_init); 1051 1051 1052 1052 /* Select the first online CPU as a designated reader. */ 1053 - if (!cpumask_weight(&i915_pmu_cpumask)) 1053 + if (cpumask_empty(&i915_pmu_cpumask)) 1054 1054 cpumask_set_cpu(cpu, &i915_pmu_cpumask); 1055 1055 1056 1056 return 0;