Skip to content

Commit 6ea0c34

Browse files
vapierhtejun
authored andcommitted
percpu: Unify input section names
The two percpu helper macros have the section names duplicated. So create a new define to merge the two. This also allows arches who need to link things more directly themselves to avoid duplicating the input sections in their linker script. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 5f55924 commit 6ea0c34

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

include/asm-generic/vmlinux.lds.h

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,28 @@
687687
*(.discard.*) \
688688
}
689689

690+
/**
691+
* PERCPU_INPUT - the percpu input sections
692+
* @cacheline: cacheline size
693+
*
694+
* The core percpu section names and core symbols which do not rely
695+
* directly upon load addresses.
696+
*
697+
* @cacheline is used to align subsections to avoid false cacheline
698+
* sharing between subsections for different purposes.
699+
*/
700+
#define PERCPU_INPUT(cacheline) \
701+
VMLINUX_SYMBOL(__per_cpu_start) = .; \
702+
*(.data..percpu..first) \
703+
. = ALIGN(PAGE_SIZE); \
704+
*(.data..percpu..page_aligned) \
705+
. = ALIGN(cacheline); \
706+
*(.data..percpu..readmostly) \
707+
. = ALIGN(cacheline); \
708+
*(.data..percpu) \
709+
*(.data..percpu..shared_aligned) \
710+
VMLINUX_SYMBOL(__per_cpu_end) = .;
711+
690712
/**
691713
* PERCPU_VADDR - define output section for percpu area
692714
* @cacheline: cacheline size
@@ -715,16 +737,7 @@
715737
VMLINUX_SYMBOL(__per_cpu_load) = .; \
716738
.data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
717739
- LOAD_OFFSET) { \
718-
VMLINUX_SYMBOL(__per_cpu_start) = .; \
719-
*(.data..percpu..first) \
720-
. = ALIGN(PAGE_SIZE); \
721-
*(.data..percpu..page_aligned) \
722-
. = ALIGN(cacheline); \
723-
*(.data..percpu..readmostly) \
724-
. = ALIGN(cacheline); \
725-
*(.data..percpu) \
726-
*(.data..percpu..shared_aligned) \
727-
VMLINUX_SYMBOL(__per_cpu_end) = .; \
740+
PERCPU_INPUT(cacheline) \
728741
} phdr \
729742
. = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
730743

@@ -745,16 +758,7 @@
745758
. = ALIGN(align); \
746759
.data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
747760
VMLINUX_SYMBOL(__per_cpu_load) = .; \
748-
VMLINUX_SYMBOL(__per_cpu_start) = .; \
749-
*(.data..percpu..first) \
750-
. = ALIGN(PAGE_SIZE); \
751-
*(.data..percpu..page_aligned) \
752-
. = ALIGN(cacheline); \
753-
*(.data..percpu..readmostly) \
754-
. = ALIGN(cacheline); \
755-
*(.data..percpu) \
756-
*(.data..percpu..shared_aligned) \
757-
VMLINUX_SYMBOL(__per_cpu_end) = .; \
761+
PERCPU_INPUT(cacheline) \
758762
}
759763

760764

0 commit comments

Comments
 (0)