From: Kyle Meyer Date: Wed, 10 Apr 2024 21:33:10 +0000 (-0500) Subject: cpumask: Add for_each_cpu_from() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6802f9347993a534797847f627c27f4334067945;p=linux.git 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 Acked-by: Yury Norov Signed-off-by: Yury Norov --- diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 1c29947db8489..d75060fbd058a 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -368,6 +368,16 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta #define for_each_cpu_or(cpu, mask1, mask2) \ for_each_or_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits) +/** + * for_each_cpu_from - iterate over CPUs present in @mask, from @cpu to the end of @mask. + * @cpu: the (optionally unsigned) integer iterator + * @mask: the cpumask pointer + * + * After the loop, cpu is >= nr_cpu_ids. + */ +#define for_each_cpu_from(cpu, mask) \ + for_each_set_bit_from(cpu, cpumask_bits(mask), small_cpumask_bits) + /** * cpumask_any_but - return a "random" in a cpumask, but not this one. * @mask: the cpumask to search