Skip to content

Commit 19df0c2

Browse files
committed
percpu: align percpu readmostly subsection to cacheline
Currently percpu readmostly subsection may share cachelines with other percpu subsections which may result in unnecessary cacheline bounce and performance degradation. This patch adds @CacheLine parameter to PERCPU() and PERCPU_VADDR() linker macros, makes each arch linker scripts specify its cacheline size and use it to align percpu subsections. This is based on Shaohua's x86 only patch. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Shaohua Li <shaohua.li@intel.com>
1 parent c723fda commit 19df0c2

19 files changed

Lines changed: 41 additions & 32 deletions

File tree

‎arch/alpha/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SECTIONS
3838
__init_begin = ALIGN(PAGE_SIZE);
3939
INIT_TEXT_SECTION(PAGE_SIZE)
4040
INIT_DATA_SECTION(16)
41-
PERCPU(PAGE_SIZE)
41+
PERCPU(64, PAGE_SIZE)
4242
/* Align to THREAD_SIZE rather than PAGE_SIZE here so any padding page
4343
needed for the THREAD_SIZE aligned init_task gets freed after init */
4444
. = ALIGN(THREAD_SIZE);

‎arch/arm/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SECTIONS
7070
#endif
7171
}
7272

73-
PERCPU(PAGE_SIZE)
73+
PERCPU(32, PAGE_SIZE)
7474

7575
#ifndef CONFIG_XIP_KERNEL
7676
. = ALIGN(PAGE_SIZE);

‎arch/blackfin/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ SECTIONS
136136

137137
. = ALIGN(16);
138138
INIT_DATA_SECTION(16)
139-
PERCPU(4)
139+
PERCPU(32, 4)
140140

141141
.exit.data :
142142
{

‎arch/cris/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ SECTIONS
107107
#endif
108108
__vmlinux_end = .; /* Last address of the physical file. */
109109
#ifdef CONFIG_ETRAX_ARCH_V32
110-
PERCPU(PAGE_SIZE)
110+
PERCPU(32, PAGE_SIZE)
111111

112112
.init.ramfs : {
113113
INIT_RAM_FS

‎arch/frv/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SECTIONS
3737
_einittext = .;
3838

3939
INIT_DATA_SECTION(8)
40-
PERCPU(4096)
40+
PERCPU(L1_CACHE_BYTES, 4096)
4141

4242
. = ALIGN(PAGE_SIZE);
4343
__init_end = .;

‎arch/ia64/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ SECTIONS {
198198

199199
/* Per-cpu data: */
200200
. = ALIGN(PERCPU_PAGE_SIZE);
201-
PERCPU_VADDR(PERCPU_ADDR, :percpu)
201+
PERCPU_VADDR(SMP_CACHE_BYTES, PERCPU_ADDR, :percpu)
202202
__phys_per_cpu_start = __per_cpu_load;
203203
/*
204204
* ensure percpu data fits

‎arch/m32r/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SECTIONS
5353
__init_begin = .;
5454
INIT_TEXT_SECTION(PAGE_SIZE)
5555
INIT_DATA_SECTION(16)
56-
PERCPU(PAGE_SIZE)
56+
PERCPU(32, PAGE_SIZE)
5757
. = ALIGN(PAGE_SIZE);
5858
__init_end = .;
5959
/* freed after init ends here */

‎arch/mips/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ SECTIONS
115115
EXIT_DATA
116116
}
117117

118-
PERCPU(PAGE_SIZE)
118+
PERCPU(1 << CONFIG_MIPS_L1_CACHE_SHIFT, PAGE_SIZE)
119119
. = ALIGN(PAGE_SIZE);
120120
__init_end = .;
121121
/* freed after init ends here */

‎arch/mn10300/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SECTIONS
7070
.exit.text : { EXIT_TEXT; }
7171
.exit.data : { EXIT_DATA; }
7272

73-
PERCPU(PAGE_SIZE)
73+
PERCPU(32, PAGE_SIZE)
7474
. = ALIGN(PAGE_SIZE);
7575
__init_end = .;
7676
/* freed after init ends here */

‎arch/parisc/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ SECTIONS
145145
EXIT_DATA
146146
}
147147

148-
PERCPU(PAGE_SIZE)
148+
PERCPU(L1_CACHE_BYTES, PAGE_SIZE)
149149
. = ALIGN(PAGE_SIZE);
150150
__init_end = .;
151151
/* freed after init ends here */

0 commit comments

Comments
 (0)