diff options
Diffstat (limited to 'include/linux/cpumask.h')
-rw-r--r-- | include/linux/cpumask.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 9bdba8169b41..13e9f4a3ab26 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -12,6 +12,8 @@ | |||
12 | * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c. | 12 | * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c. |
13 | * For details of cpulist_scnprintf() and cpulist_parse(), see | 13 | * For details of cpulist_scnprintf() and cpulist_parse(), see |
14 | * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. | 14 | * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. |
15 | * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c | ||
16 | * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c. | ||
15 | * | 17 | * |
16 | * The available cpumask operations are: | 18 | * The available cpumask operations are: |
17 | * | 19 | * |
@@ -50,6 +52,8 @@ | |||
50 | * int cpumask_parse(ubuf, ulen, mask) Parse ascii string as cpumask | 52 | * int cpumask_parse(ubuf, ulen, mask) Parse ascii string as cpumask |
51 | * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing | 53 | * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing |
52 | * int cpulist_parse(buf, map) Parse ascii string as cpulist | 54 | * int cpulist_parse(buf, map) Parse ascii string as cpulist |
55 | * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit) | ||
56 | * int cpus_remap(dst, src, old, new) *dst = map(old, new)(src) | ||
53 | * | 57 | * |
54 | * for_each_cpu_mask(cpu, mask) for-loop cpu over mask | 58 | * for_each_cpu_mask(cpu, mask) for-loop cpu over mask |
55 | * | 59 | * |
@@ -294,6 +298,22 @@ static inline int __cpulist_parse(const char *buf, cpumask_t *dstp, int nbits) | |||
294 | return bitmap_parselist(buf, dstp->bits, nbits); | 298 | return bitmap_parselist(buf, dstp->bits, nbits); |
295 | } | 299 | } |
296 | 300 | ||
301 | #define cpu_remap(oldbit, old, new) \ | ||
302 | __cpu_remap((oldbit), &(old), &(new), NR_CPUS) | ||
303 | static inline int __cpu_remap(int oldbit, | ||
304 | const cpumask_t *oldp, const cpumask_t *newp, int nbits) | ||
305 | { | ||
306 | return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits); | ||
307 | } | ||
308 | |||
309 | #define cpus_remap(dst, src, old, new) \ | ||
310 | __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS) | ||
311 | static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp, | ||
312 | const cpumask_t *oldp, const cpumask_t *newp, int nbits) | ||
313 | { | ||
314 | bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); | ||
315 | } | ||
316 | |||
297 | #if NR_CPUS > 1 | 317 | #if NR_CPUS > 1 |
298 | #define for_each_cpu_mask(cpu, mask) \ | 318 | #define for_each_cpu_mask(cpu, mask) \ |
299 | for ((cpu) = first_cpu(mask); \ | 319 | for ((cpu) = first_cpu(mask); \ |