diff options
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 29510d68338a..e202a68d1cc1 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -455,3 +455,28 @@ out: | |||
455 | #endif /* CONFIG_PM_SLEEP_SMP */ | 455 | #endif /* CONFIG_PM_SLEEP_SMP */ |
456 | 456 | ||
457 | #endif /* CONFIG_SMP */ | 457 | #endif /* CONFIG_SMP */ |
458 | |||
459 | /* | ||
460 | * cpu_bit_bitmap[] is a special, "compressed" data structure that | ||
461 | * represents all NR_CPUS bits binary values of 1<<nr. | ||
462 | * | ||
463 | * It is used by cpumask_of_cpu() to get a constant address to a CPU | ||
464 | * mask value that has a single bit set only. | ||
465 | */ | ||
466 | |||
467 | /* cpu_bit_bitmap[0] is empty - so we can back into it */ | ||
468 | #define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x) | ||
469 | #define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1) | ||
470 | #define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2) | ||
471 | #define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4) | ||
472 | |||
473 | const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = { | ||
474 | |||
475 | MASK_DECLARE_8(0), MASK_DECLARE_8(8), | ||
476 | MASK_DECLARE_8(16), MASK_DECLARE_8(24), | ||
477 | #if BITS_PER_LONG > 32 | ||
478 | MASK_DECLARE_8(32), MASK_DECLARE_8(40), | ||
479 | MASK_DECLARE_8(48), MASK_DECLARE_8(56), | ||
480 | #endif | ||
481 | }; | ||
482 | EXPORT_SYMBOL_GPL(cpu_bit_bitmap); | ||