Skip to content

Commit 99248e3

Browse files
committed
genirq/affinity: replace cpumask_weight with cpumask_empty where appropriate
__irq_build_affinity_masks() 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]>
1 parent d72002a commit 99248e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/irq/affinity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static int __irq_build_affinity_masks(unsigned int startvec,
258258
nodemask_t nodemsk = NODE_MASK_NONE;
259259
struct node_vectors *node_vectors;
260260

261-
if (!cpumask_weight(cpu_mask))
261+
if (cpumask_empty(cpu_mask))
262262
return 0;
263263

264264
nodes = get_nodes_in_cpumask(node_to_cpumask, cpu_mask, &nodemsk);

0 commit comments

Comments
 (0)