Skip to content

Commit 566babe

Browse files
committed
cpumask: use cpumask_next_wrap() where appropriate
Now that cpumask_next{_and}_wrap() is wired to generic find_next_bit_wrap(), we can use it in cpumask_any{_and}_distribute(). This automatically makes the cpumask_*_distribute() functions to use small_cpumask_bits instead of nr_cpumask_bits, which itself is a good optimization. Signed-off-by: Yury Norov <[email protected]>
1 parent 3268cb2 commit 566babe

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/cpumask.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
171171
/* NOTE: our first selection will skip 0. */
172172
prev = __this_cpu_read(distribute_cpu_mask_prev);
173173

174-
next = find_next_and_bit_wrap(cpumask_bits(src1p), cpumask_bits(src2p),
175-
nr_cpumask_bits, prev + 1);
174+
next = cpumask_next_and_wrap(prev, src1p, src2p);
176175
if (next < nr_cpu_ids)
177176
__this_cpu_write(distribute_cpu_mask_prev, next);
178177

@@ -192,7 +191,7 @@ unsigned int cpumask_any_distribute(const struct cpumask *srcp)
192191

193192
/* NOTE: our first selection will skip 0. */
194193
prev = __this_cpu_read(distribute_cpu_mask_prev);
195-
next = find_next_bit_wrap(cpumask_bits(srcp), nr_cpumask_bits, prev + 1);
194+
next = cpumask_next_wrap(prev, srcp);
196195
if (next < nr_cpu_ids)
197196
__this_cpu_write(distribute_cpu_mask_prev, next);
198197

0 commit comments

Comments
 (0)