diff options
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r-- | include/linux/percpu.h | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 9f2a3751873a..3577ffd90d45 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -8,35 +8,46 @@ | |||
8 | 8 | ||
9 | #include <asm/percpu.h> | 9 | #include <asm/percpu.h> |
10 | 10 | ||
11 | #ifndef PER_CPU_BASE_SECTION | ||
12 | #ifdef CONFIG_SMP | ||
13 | #define PER_CPU_BASE_SECTION ".data.percpu" | ||
14 | #else | ||
15 | #define PER_CPU_BASE_SECTION ".data" | ||
16 | #endif | ||
17 | #endif | ||
18 | |||
11 | #ifdef CONFIG_SMP | 19 | #ifdef CONFIG_SMP |
12 | #define DEFINE_PER_CPU(type, name) \ | ||
13 | __attribute__((__section__(".data.percpu"))) \ | ||
14 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
15 | 20 | ||
16 | #ifdef MODULE | 21 | #ifdef MODULE |
17 | #define SHARED_ALIGNED_SECTION ".data.percpu" | 22 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
18 | #else | 23 | #else |
19 | #define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned" | 24 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" |
20 | #endif | 25 | #endif |
26 | #define PER_CPU_FIRST_SECTION ".first" | ||
21 | 27 | ||
22 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 28 | #else |
23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ | ||
24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | ||
25 | ____cacheline_aligned_in_smp | ||
26 | 29 | ||
27 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 30 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
28 | __attribute__((__section__(".data.percpu.page_aligned"))) \ | 31 | #define PER_CPU_FIRST_SECTION "" |
32 | |||
33 | #endif | ||
34 | |||
35 | #define DEFINE_PER_CPU_SECTION(type, name, section) \ | ||
36 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ | ||
29 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 37 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
30 | #else | 38 | |
31 | #define DEFINE_PER_CPU(type, name) \ | 39 | #define DEFINE_PER_CPU(type, name) \ |
32 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 40 | DEFINE_PER_CPU_SECTION(type, name, "") |
33 | 41 | ||
34 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 42 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
35 | DEFINE_PER_CPU(type, name) | 43 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ |
44 | ____cacheline_aligned_in_smp | ||
36 | 45 | ||
37 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 46 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ |
38 | DEFINE_PER_CPU(type, name) | 47 | DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") |
39 | #endif | 48 | |
49 | #define DEFINE_PER_CPU_FIRST(type, name) \ | ||
50 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) | ||
40 | 51 | ||
41 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 52 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
42 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 53 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) |