X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Flinux%2Fcpumask.h;h=1b6ce8c2401a055946dc08082da9cb5e99b1701c;hb=3cc0730eef779b6d7e27d6dfa5bd81f76a2baa0c;hp=4f7a632374713c73fe096bb81f0f9daf122571c9;hpb=8b6b4628126fd73d0a53b499a26133c15b73c1e6;p=pandora-kernel.git diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 4f7a63237471..1b6ce8c2401a 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -216,6 +216,23 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); (cpu) = cpumask_next_zero((cpu), (mask)), \ (cpu) < nr_cpu_ids;) +extern int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap); + +/** + * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location + * @cpu: the (optionally unsigned) integer iterator + * @mask: the cpumask poiter + * @start: the start location + * + * The implementation does not assume any bit in @mask is set (including @start). + * + * After the loop, cpu is >= nr_cpu_ids. + */ +#define for_each_cpu_wrap(cpu, mask, start) \ + for ((cpu) = cpumask_next_wrap((start)-1, (mask), (start), false); \ + (cpu) < nr_cpumask_bits; \ + (cpu) = cpumask_next_wrap((cpu), (mask), (start), true)) + /** * for_each_cpu_and - iterate over every cpu in both masks * @cpu: the (optionally unsigned) integer iterator