Skip to content

Commit a37e94f

Browse files
committed
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 <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]>
1 parent 4aec74b commit a37e94f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ static int i915_pmu_cpu_online(unsigned int cpu, struct hlist_node *node)
10501050
GEM_BUG_ON(!pmu->base.event_init);
10511051

10521052
/* Select the first online CPU as a designated reader. */
1053-
if (!cpumask_weight(&i915_pmu_cpumask))
1053+
if (cpumask_empty(&i915_pmu_cpumask))
10541054
cpumask_set_cpu(cpu, &i915_pmu_cpumask);
10551055

10561056
return 0;

0 commit comments

Comments
 (0)