mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 01:51:39 +00:00
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>
This commit is contained in:
parent
c723fdab8a
commit
19df0c2fef
19 changed files with 41 additions and 32 deletions
|
@ -15,7 +15,7 @@
|
|||
* HEAD_TEXT_SECTION
|
||||
* INIT_TEXT_SECTION(PAGE_SIZE)
|
||||
* INIT_DATA_SECTION(...)
|
||||
* PERCPU(PAGE_SIZE)
|
||||
* PERCPU(CACHELINE_SIZE, PAGE_SIZE)
|
||||
* __init_end = .;
|
||||
*
|
||||
* _stext = .;
|
||||
|
@ -683,13 +683,18 @@
|
|||
|
||||
/**
|
||||
* PERCPU_VADDR - define output section for percpu area
|
||||
* @cacheline: cacheline size
|
||||
* @vaddr: explicit base address (optional)
|
||||
* @phdr: destination PHDR (optional)
|
||||
*
|
||||
* Macro which expands to output section for percpu area. If @vaddr
|
||||
* is not blank, it specifies explicit base address and all percpu
|
||||
* symbols will be offset from the given address. If blank, @vaddr
|
||||
* always equals @laddr + LOAD_OFFSET.
|
||||
* Macro which expands to output section for percpu area.
|
||||
*
|
||||
* @cacheline is used to align subsections to avoid false cacheline
|
||||
* sharing between subsections for different purposes.
|
||||
*
|
||||
* If @vaddr is not blank, it specifies explicit base address and all
|
||||
* percpu symbols will be offset from the given address. If blank,
|
||||
* @vaddr always equals @laddr + LOAD_OFFSET.
|
||||
*
|
||||
* @phdr defines the output PHDR to use if not blank. Be warned that
|
||||
* output PHDR is sticky. If @phdr is specified, the next output
|
||||
|
@ -700,7 +705,7 @@
|
|||
* If there is no need to put the percpu section at a predetermined
|
||||
* address, use PERCPU().
|
||||
*/
|
||||
#define PERCPU_VADDR(vaddr, phdr) \
|
||||
#define PERCPU_VADDR(cacheline, vaddr, phdr) \
|
||||
VMLINUX_SYMBOL(__per_cpu_load) = .; \
|
||||
.data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
|
||||
- LOAD_OFFSET) { \
|
||||
|
@ -708,7 +713,9 @@
|
|||
*(.data..percpu..first) \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
*(.data..percpu..page_aligned) \
|
||||
. = ALIGN(cacheline); \
|
||||
*(.data..percpu..readmostly) \
|
||||
. = ALIGN(cacheline); \
|
||||
*(.data..percpu) \
|
||||
*(.data..percpu..shared_aligned) \
|
||||
VMLINUX_SYMBOL(__per_cpu_end) = .; \
|
||||
|
@ -717,18 +724,18 @@
|
|||
|
||||
/**
|
||||
* PERCPU - define output section for percpu area, simple version
|
||||
* @cacheline: cacheline size
|
||||
* @align: required alignment
|
||||
*
|
||||
* Align to @align and outputs output section for percpu area. This
|
||||
* macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
|
||||
* Align to @align and outputs output section for percpu area. This macro
|
||||
* doesn't manipulate @vaddr or @phdr and __per_cpu_load and
|
||||
* __per_cpu_start will be identical.
|
||||
*
|
||||
* This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
|
||||
* that __per_cpu_load is defined as a relative symbol against
|
||||
* .data..percpu which is required for relocatable x86_32
|
||||
* configuration.
|
||||
* This macro is equivalent to ALIGN(@align); PERCPU_VADDR(@cacheline,,)
|
||||
* except that __per_cpu_load is defined as a relative symbol against
|
||||
* .data..percpu which is required for relocatable x86_32 configuration.
|
||||
*/
|
||||
#define PERCPU(align) \
|
||||
#define PERCPU(cacheline, align) \
|
||||
. = ALIGN(align); \
|
||||
.data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__per_cpu_load) = .; \
|
||||
|
@ -736,7 +743,9 @@
|
|||
*(.data..percpu..first) \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
*(.data..percpu..page_aligned) \
|
||||
. = ALIGN(cacheline); \
|
||||
*(.data..percpu..readmostly) \
|
||||
. = ALIGN(cacheline); \
|
||||
*(.data..percpu) \
|
||||
*(.data..percpu..shared_aligned) \
|
||||
VMLINUX_SYMBOL(__per_cpu_end) = .; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue