Skip to content

Commit 5fb7dc3

Browse files
Fenghua YuLinus Torvalds
authored andcommitted
define new percpu interface for shared data
per cpu data section contains two types of data. One set which is exclusively accessed by the local cpu and the other set which is per cpu, but also shared by remote cpus. In the current kernel, these two sets are not clearely separated out. This can potentially cause the same data cacheline shared between the two sets of data, which will result in unnecessary bouncing of the cacheline between cpus. One way to fix the problem is to cacheline align the remotely accessed per cpu data, both at the beginning and at the end. Because of the padding at both ends, this will likely cause some memory wastage and also the interface to achieve this is not clean. This patch: Moves the remotely accessed per cpu data (which is currently marked as ____cacheline_aligned_in_smp) into a different section, where all the data elements are cacheline aligned. And as such, this differentiates the local only data and remotely accessed data cleanly. Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Christoph Lameter <clameter@sgi.com> Cc: <linux-arch@vger.kernel.org> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3d7e338 commit 5fb7dc3

26 files changed

Lines changed: 84 additions & 53 deletions

File tree

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ SECTIONS
6969
. = ALIGN(8);
7070
SECURITY_INIT
7171

72-
. = ALIGN(8192);
73-
__per_cpu_start = .;
74-
.data.percpu : { *(.data.percpu) }
75-
__per_cpu_end = .;
72+
PERCPU(8192)
7673

7774
. = ALIGN(2*8192);
7875
__init_end = .;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ SECTIONS
6666
. = ALIGN(4096);
6767
__per_cpu_start = .;
6868
*(.data.percpu)
69+
*(.data.percpu.shared_aligned)
6970
__per_cpu_end = .;
7071
#ifndef CONFIG_XIP_KERNEL
7172
__init_begin = _stext;

‎arch/cris/arch-v32/vmlinux.lds.S‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ SECTIONS
9191
}
9292
SECURITY_INIT
9393

94-
. = ALIGN (8192);
95-
__per_cpu_start = .;
96-
.data.percpu : { *(.data.percpu) }
97-
__per_cpu_end = .;
94+
PERCPU(8192)
9895

9996
#ifdef CONFIG_BLK_DEV_INITRD
10097
.init.ramfs : {

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ SECTIONS
5757
__alt_instructions_end = .;
5858
.altinstr_replacement : { *(.altinstr_replacement) }
5959

60-
. = ALIGN(4096);
61-
__per_cpu_start = .;
62-
.data.percpu : { *(.data.percpu) }
63-
__per_cpu_end = .;
60+
PERCPU(4096)
6461

6562
#ifdef CONFIG_BLK_DEV_INITRD
6663
. = ALIGN(4096);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ SECTIONS
181181
.data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
182182
__per_cpu_start = .;
183183
*(.data.percpu)
184+
*(.data.percpu.shared_aligned)
184185
__per_cpu_end = .;
185186
}
186187
. = ALIGN(4096);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ SECTIONS
206206
{
207207
__per_cpu_start = .;
208208
*(.data.percpu)
209+
*(.data.percpu.shared_aligned)
209210
__per_cpu_end = .;
210211
}
211212
. = __phys_per_cpu_start + PERCPU_PAGE_SIZE; /* ensure percpu data fits

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ SECTIONS
110110
__initramfs_end = .;
111111
#endif
112112

113-
. = ALIGN(4096);
114-
__per_cpu_start = .;
115-
.data.percpu : { *(.data.percpu) }
116-
__per_cpu_end = .;
113+
PERCPU(4096)
117114
. = ALIGN(4096);
118115
__init_end = .;
119116
/* freed after init ends here */

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ SECTIONS
119119
.init.ramfs : { *(.init.ramfs) }
120120
__initramfs_end = .;
121121
#endif
122-
. = ALIGN(_PAGE_SIZE);
123-
__per_cpu_start = .;
124-
.data.percpu : { *(.data.percpu) }
125-
__per_cpu_end = .;
122+
PERCPU(_PAGE_SIZE)
126123
. = ALIGN(_PAGE_SIZE);
127124
__init_end = .;
128125
/* freed after init ends here */

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,9 @@ SECTIONS
181181
.init.ramfs : { *(.init.ramfs) }
182182
__initramfs_end = .;
183183
#endif
184-
. = ALIGN(ASM_PAGE_SIZE);
185-
__per_cpu_start = .;
186-
.data.percpu : { *(.data.percpu) }
187-
__per_cpu_end = .;
184+
185+
PERCPU(ASM_PAGE_SIZE)
186+
188187
. = ALIGN(ASM_PAGE_SIZE);
189188
__init_end = .;
190189
/* freed after init ends here */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ SECTIONS
144144
.data.percpu : {
145145
__per_cpu_start = .;
146146
*(.data.percpu)
147+
*(.data.percpu.shared_aligned)
147148
__per_cpu_end = .;
148149
}
149150

0 commit comments

Comments
 (0)