···332332#define for_each_cpu(cpu, mask) \333333 for_each_set_bit(cpu, cpumask_bits(mask), small_cpumask_bits)334334335335-#if NR_CPUS == 1336336-static __always_inline337337-unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap)338338-{339339- cpumask_check(start);340340- if (n != -1)341341- cpumask_check(n);342342-343343- /*344344- * Return the first available CPU when wrapping, or when starting before cpu0,345345- * since there is only one valid option.346346- */347347- if (wrap && n >= 0)348348- return nr_cpumask_bits;349349-350350- return cpumask_first(mask);351351-}352352-#else353353-unsigned int __pure cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap);354354-#endif355355-356335/**357336 * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location358337 * @cpu: the (optionally unsigned) integer iterator
-32
lib/cpumask.c
···77#include <linux/memblock.h>88#include <linux/numa.h>991010-/**1111- * cpumask_next_wrap_old - helper to implement for_each_cpu_wrap1212- * @n: the cpu prior to the place to search1313- * @mask: the cpumask pointer1414- * @start: the start point of the iteration1515- * @wrap: assume @n crossing @start terminates the iteration1616- *1717- * Return: >= nr_cpu_ids on completion1818- *1919- * Note: the @wrap argument is required for the start condition when2020- * we cannot assume @start is set in @mask.2121- */2222-unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap)2323-{2424- unsigned int next;2525-2626-again:2727- next = cpumask_next(n, mask);2828-2929- if (wrap && n < start && next >= start) {3030- return nr_cpumask_bits;3131-3232- } else if (next >= nr_cpumask_bits) {3333- wrap = true;3434- n = -1;3535- goto again;3636- }3737-3838- return next;3939-}4040-EXPORT_SYMBOL(cpumask_next_wrap_old);4141-4210/* These are not inline because of header tangles. */4311#ifdef CONFIG_CPUMASK_OFFSTACK4412/**