diff options
-rw-r--r-- | arch/alpha/include/asm/percpu.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/smp.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/desc.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/hardirq.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/processor.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/tlbflush.h | 2 | ||||
-rw-r--r-- | include/asm-generic/percpu.h | 43 | ||||
-rw-r--r-- | include/linux/percpu.h | 24 | ||||
-rw-r--r-- | net/rds/rds.h | 2 |
9 files changed, 50 insertions, 35 deletions
diff --git a/arch/alpha/include/asm/percpu.h b/arch/alpha/include/asm/percpu.h index 3495e8e00d70..e9e0bb5a23bf 100644 --- a/arch/alpha/include/asm/percpu.h +++ b/arch/alpha/include/asm/percpu.h | |||
@@ -73,6 +73,6 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
73 | 73 | ||
74 | #endif /* SMP */ | 74 | #endif /* SMP */ |
75 | 75 | ||
76 | #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name) | 76 | #include <asm-generic/percpu.h> |
77 | 77 | ||
78 | #endif /* __ALPHA_PERCPU_H */ | 78 | #endif /* __ALPHA_PERCPU_H */ |
diff --git a/arch/ia64/include/asm/smp.h b/arch/ia64/include/asm/smp.h index 598408336251..d217d1d4e051 100644 --- a/arch/ia64/include/asm/smp.h +++ b/arch/ia64/include/asm/smp.h | |||
@@ -58,7 +58,7 @@ extern struct smp_boot_data { | |||
58 | extern char no_int_routing __devinitdata; | 58 | extern char no_int_routing __devinitdata; |
59 | 59 | ||
60 | extern cpumask_t cpu_core_map[NR_CPUS]; | 60 | extern cpumask_t cpu_core_map[NR_CPUS]; |
61 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 61 | DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map); |
62 | extern int smp_num_siblings; | 62 | extern int smp_num_siblings; |
63 | extern void __iomem *ipi_base_addr; | 63 | extern void __iomem *ipi_base_addr; |
64 | extern unsigned char smp_int_redirect; | 64 | extern unsigned char smp_int_redirect; |
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index 5623c50d67b2..c45f415ce315 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h | |||
@@ -37,7 +37,7 @@ extern gate_desc idt_table[]; | |||
37 | struct gdt_page { | 37 | struct gdt_page { |
38 | struct desc_struct gdt[GDT_ENTRIES]; | 38 | struct desc_struct gdt[GDT_ENTRIES]; |
39 | } __attribute__((aligned(PAGE_SIZE))); | 39 | } __attribute__((aligned(PAGE_SIZE))); |
40 | DECLARE_PER_CPU(struct gdt_page, gdt_page); | 40 | DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page); |
41 | 41 | ||
42 | static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) | 42 | static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) |
43 | { | 43 | { |
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h index 039db6aa8e02..37555e52f980 100644 --- a/arch/x86/include/asm/hardirq.h +++ b/arch/x86/include/asm/hardirq.h | |||
@@ -26,7 +26,7 @@ typedef struct { | |||
26 | #endif | 26 | #endif |
27 | } ____cacheline_aligned irq_cpustat_t; | 27 | } ____cacheline_aligned irq_cpustat_t; |
28 | 28 | ||
29 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | 29 | DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); |
30 | 30 | ||
31 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | 31 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ |
32 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | 32 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index fcf4d92e7e04..c2cceae709c8 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -138,7 +138,7 @@ extern struct tss_struct doublefault_tss; | |||
138 | extern __u32 cleared_cpu_caps[NCAPINTS]; | 138 | extern __u32 cleared_cpu_caps[NCAPINTS]; |
139 | 139 | ||
140 | #ifdef CONFIG_SMP | 140 | #ifdef CONFIG_SMP |
141 | DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); | 141 | DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
142 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) | 142 | #define cpu_data(cpu) per_cpu(cpu_info, cpu) |
143 | #define current_cpu_data __get_cpu_var(cpu_info) | 143 | #define current_cpu_data __get_cpu_var(cpu_info) |
144 | #else | 144 | #else |
@@ -270,7 +270,7 @@ struct tss_struct { | |||
270 | 270 | ||
271 | } ____cacheline_aligned; | 271 | } ____cacheline_aligned; |
272 | 272 | ||
273 | DECLARE_PER_CPU(struct tss_struct, init_tss); | 273 | DECLARE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss); |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * Save the original ist values for checking stack pointers during debugging | 276 | * Save the original ist values for checking stack pointers during debugging |
@@ -393,7 +393,7 @@ union irq_stack_union { | |||
393 | }; | 393 | }; |
394 | }; | 394 | }; |
395 | 395 | ||
396 | DECLARE_PER_CPU(union irq_stack_union, irq_stack_union); | 396 | DECLARE_PER_CPU_FIRST(union irq_stack_union, irq_stack_union); |
397 | DECLARE_INIT_PER_CPU(irq_stack_union); | 397 | DECLARE_INIT_PER_CPU(irq_stack_union); |
398 | 398 | ||
399 | DECLARE_PER_CPU(char *, irq_stack_ptr); | 399 | DECLARE_PER_CPU(char *, irq_stack_ptr); |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index d3539f998f88..16a5c84b0329 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -152,7 +152,7 @@ struct tlb_state { | |||
152 | struct mm_struct *active_mm; | 152 | struct mm_struct *active_mm; |
153 | int state; | 153 | int state; |
154 | }; | 154 | }; |
155 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); | 155 | DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate); |
156 | 156 | ||
157 | static inline void reset_lazy_tlbstate(void) | 157 | static inline void reset_lazy_tlbstate(void) |
158 | { | 158 | { |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index b0e63c672ebd..af47b9e10064 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -73,11 +73,50 @@ extern void setup_per_cpu_areas(void); | |||
73 | 73 | ||
74 | #endif /* SMP */ | 74 | #endif /* SMP */ |
75 | 75 | ||
76 | #ifndef PER_CPU_BASE_SECTION | ||
77 | #ifdef CONFIG_SMP | ||
78 | #define PER_CPU_BASE_SECTION ".data.percpu" | ||
79 | #else | ||
80 | #define PER_CPU_BASE_SECTION ".data" | ||
81 | #endif | ||
82 | #endif | ||
83 | |||
84 | #ifdef CONFIG_SMP | ||
85 | |||
86 | #ifdef MODULE | ||
87 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
88 | #else | ||
89 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" | ||
90 | #endif | ||
91 | #define PER_CPU_FIRST_SECTION ".first" | ||
92 | |||
93 | #else | ||
94 | |||
95 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
96 | #define PER_CPU_FIRST_SECTION "" | ||
97 | |||
98 | #endif | ||
99 | |||
76 | #ifndef PER_CPU_ATTRIBUTES | 100 | #ifndef PER_CPU_ATTRIBUTES |
77 | #define PER_CPU_ATTRIBUTES | 101 | #define PER_CPU_ATTRIBUTES |
78 | #endif | 102 | #endif |
79 | 103 | ||
80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ | 104 | #define DECLARE_PER_CPU_SECTION(type, name, section) \ |
81 | __typeof__(type) per_cpu_var(name) | 105 | extern \ |
106 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ | ||
107 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
108 | |||
109 | #define DECLARE_PER_CPU(type, name) \ | ||
110 | DECLARE_PER_CPU_SECTION(type, name, "") | ||
111 | |||
112 | #define DECLARE_PER_CPU_SHARED_ALIGNED(type, name) \ | ||
113 | DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ | ||
114 | ____cacheline_aligned_in_smp | ||
115 | |||
116 | #define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ | ||
117 | DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") | ||
118 | |||
119 | #define DECLARE_PER_CPU_FIRST(type, name) \ | ||
120 | DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) | ||
82 | 121 | ||
83 | #endif /* _ASM_GENERIC_PERCPU_H_ */ | 122 | #endif /* _ASM_GENERIC_PERCPU_H_ */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index cfda2d5ad319..f052d8184993 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -9,30 +9,6 @@ | |||
9 | 9 | ||
10 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
11 | 11 | ||
12 | #ifndef PER_CPU_BASE_SECTION | ||
13 | #ifdef CONFIG_SMP | ||
14 | #define PER_CPU_BASE_SECTION ".data.percpu" | ||
15 | #else | ||
16 | #define PER_CPU_BASE_SECTION ".data" | ||
17 | #endif | ||
18 | #endif | ||
19 | |||
20 | #ifdef CONFIG_SMP | ||
21 | |||
22 | #ifdef MODULE | ||
23 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
24 | #else | ||
25 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" | ||
26 | #endif | ||
27 | #define PER_CPU_FIRST_SECTION ".first" | ||
28 | |||
29 | #else | ||
30 | |||
31 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
32 | #define PER_CPU_FIRST_SECTION "" | ||
33 | |||
34 | #endif | ||
35 | |||
36 | #define DEFINE_PER_CPU_SECTION(type, name, section) \ | 12 | #define DEFINE_PER_CPU_SECTION(type, name, section) \ |
37 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ | 13 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ |
38 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 14 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
diff --git a/net/rds/rds.h b/net/rds/rds.h index 619f0a30a4e5..71794449ca4e 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
@@ -638,7 +638,7 @@ struct rds_message *rds_send_get_message(struct rds_connection *, | |||
638 | void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force); | 638 | void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force); |
639 | 639 | ||
640 | /* stats.c */ | 640 | /* stats.c */ |
641 | DECLARE_PER_CPU(struct rds_statistics, rds_stats); | 641 | DECLARE_PER_CPU_SHARED_ALIGNED(struct rds_statistics, rds_stats); |
642 | #define rds_stats_inc_which(which, member) do { \ | 642 | #define rds_stats_inc_which(which, member) do { \ |
643 | per_cpu(which, get_cpu()).member++; \ | 643 | per_cpu(which, get_cpu()).member++; \ |
644 | put_cpu(); \ | 644 | put_cpu(); \ |