@@ -200,14 +200,16 @@ SECTIONS
*(.bss.stack_aligned)
. = ALIGN(PAGE_SIZE);
*(.bss.page_aligned)
- *(.bss)
- . = ALIGN(SMP_CACHE_BYTES);
+ . = ALIGN(PAGE_SIZE);
__per_cpu_start = .;
+ *(.bss.percpu.page_aligned)
*(.bss.percpu)
. = ALIGN(SMP_CACHE_BYTES);
*(.bss.percpu.read_mostly)
. = ALIGN(SMP_CACHE_BYTES);
__per_cpu_data_end = .;
+ *(.bss)
+ . = ALIGN(POINTER_ALIGN);
__bss_end = .;
} :text
_end = . ;
@@ -292,14 +292,16 @@ SECTIONS
__bss_start = .;
*(.bss.stack_aligned)
*(.bss.page_aligned*)
- *(.bss)
- . = ALIGN(SMP_CACHE_BYTES);
+ . = ALIGN(PAGE_SIZE);
__per_cpu_start = .;
+ *(.bss.percpu.page_aligned)
*(.bss.percpu)
. = ALIGN(SMP_CACHE_BYTES);
*(.bss.percpu.read_mostly)
. = ALIGN(SMP_CACHE_BYTES);
__per_cpu_data_end = .;
+ *(.bss)
+ . = ALIGN(POINTER_ALIGN);
__bss_end = .;
} :text
_end = . ;
@@ -10,10 +10,8 @@ extern char __per_cpu_start[], __per_cpu
extern unsigned long __per_cpu_offset[NR_CPUS];
void percpu_init_areas(void);
-/* Separate out the type, so (int[3], foo) works. */
-#define __DEFINE_PER_CPU(type, name, suffix) \
- __section(".bss.percpu" #suffix) \
- __typeof__(type) per_cpu_##name
+#define __DEFINE_PER_CPU(attr, type, name) \
+ attr __typeof__(type) per_cpu_ ## name
#define per_cpu(var, cpu) \
(*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
@@ -7,10 +7,8 @@ extern unsigned long __per_cpu_offset[NR
void percpu_init_areas(void);
#endif
-/* Separate out the type, so (int[3], foo) works. */
-#define __DEFINE_PER_CPU(type, name, suffix) \
- __section(".bss.percpu" #suffix) \
- __typeof__(type) per_cpu_##name
+#define __DEFINE_PER_CPU(attr, type, name) \
+ attr __typeof__(type) per_cpu_ ## name
/* var is in discarded region: offset to particular copy we want */
#define per_cpu(var, cpu) \
@@ -9,9 +9,17 @@
* The _##name concatenation is being used here to prevent 'name' from getting
* macro expanded, while still allowing a per-architecture symbol name prefix.
*/
-#define DEFINE_PER_CPU(type, name) __DEFINE_PER_CPU(type, _##name, )
+#define DEFINE_PER_CPU(type, name) \
+ __DEFINE_PER_CPU(__section(".bss.percpu"), type, _ ## name)
+
+#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
+ typedef char name ## _chk_t[BUILD_BUG_ON_ZERO(__alignof(type) & \
+ (PAGE_SIZE - 1))]; \
+ __DEFINE_PER_CPU(__section(".bss.percpu.page_aligned"), \
+ type, _ ## name)
+
#define DEFINE_PER_CPU_READ_MOSTLY(type, name) \
- __DEFINE_PER_CPU(type, _##name, .read_mostly)
+ __DEFINE_PER_CPU(__section(".bss.percpu.read_mostly"), type, _ ## name)
#define get_per_cpu_var(var) (per_cpu__##var)