Skip to content

Commit 6802f93

Browse files
Kyle MeyerYuryNorov
authored andcommitted
cpumask: Add for_each_cpu_from()
Add for_each_cpu_from() as a generic cpumask macro. for_each_cpu_from() is the same as for_each_cpu(), except it starts at @cpu instead of zero. Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com> Acked-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Yury Norov <yury.norov@gmail.com>
1 parent 678e14c commit 6802f93

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/cpumask.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,16 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta
368368
#define for_each_cpu_or(cpu, mask1, mask2) \
369369
for_each_or_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
370370

371+
/**
372+
* for_each_cpu_from - iterate over CPUs present in @mask, from @cpu to the end of @mask.
373+
* @cpu: the (optionally unsigned) integer iterator
374+
* @mask: the cpumask pointer
375+
*
376+
* After the loop, cpu is >= nr_cpu_ids.
377+
*/
378+
#define for_each_cpu_from(cpu, mask) \
379+
for_each_set_bit_from(cpu, cpumask_bits(mask), small_cpumask_bits)
380+
371381
/**
372382
* cpumask_any_but - return a "random" in a cpumask, but not this one.
373383
* @mask: the cpumask to search

0 commit comments

Comments
 (0)