Skip to content

Commit

Permalink
genirq/affinity: replace cpumask_weight with cpumask_empty where appr…
Browse files Browse the repository at this point in the history
…opriate

__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]>
  • Loading branch information
YuryNorov committed Jun 3, 2022
1 parent d72002a commit 99248e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/irq/affinity.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static int __irq_build_affinity_masks(unsigned int startvec,
nodemask_t nodemsk = NODE_MASK_NONE;
struct node_vectors *node_vectors;

if (!cpumask_weight(cpu_mask))
if (cpumask_empty(cpu_mask))
return 0;

nodes = get_nodes_in_cpumask(node_to_cpumask, cpu_mask, &nodemsk);
Expand Down

0 comments on commit 99248e3

Please sign in to comment.