diff options
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r-- | include/linux/percpu.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 926adaae0f96..1ac969724bb2 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -9,6 +9,26 @@ | |||
9 | 9 | ||
10 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
11 | 11 | ||
12 | #ifdef CONFIG_SMP | ||
13 | #define DEFINE_PER_CPU(type, name) \ | ||
14 | __attribute__((__section__(".data.percpu"))) \ | ||
15 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
16 | |||
17 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | ||
18 | __attribute__((__section__(".data.percpu.shared_aligned"))) \ | ||
19 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | ||
20 | ____cacheline_aligned_in_smp | ||
21 | #else | ||
22 | #define DEFINE_PER_CPU(type, name) \ | ||
23 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
24 | |||
25 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | ||
26 | DEFINE_PER_CPU(type, name) | ||
27 | #endif | ||
28 | |||
29 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | ||
30 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | ||
31 | |||
12 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ | 32 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ |
13 | #ifndef PERCPU_ENOUGH_ROOM | 33 | #ifndef PERCPU_ENOUGH_ROOM |
14 | #ifdef CONFIG_MODULES | 34 | #ifdef CONFIG_MODULES |
@@ -34,7 +54,7 @@ | |||
34 | #ifdef CONFIG_SMP | 54 | #ifdef CONFIG_SMP |
35 | 55 | ||
36 | struct percpu_data { | 56 | struct percpu_data { |
37 | void *ptrs[NR_CPUS]; | 57 | void *ptrs[1]; |
38 | }; | 58 | }; |
39 | 59 | ||
40 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) | 60 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) |