Skip to content

Commit 911488d

Browse files
YuryNorovKAGA-KOKO
authored andcommitted
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. This can be done 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]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3f893a5 commit 911488d

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)