Commit c957ef2c authored by Shaohua Li's avatar Shaohua Li Committed by H. Peter Anvin

percpu: Introduce a read-mostly percpu API

Add a new readmostly percpu section and API.  This can be used to
avoid dirtying data lines which are generally not written to, which is
especially important for data which may be accessed by processors
other than the one for which the percpu area belongs to.

[ hpa: moved it *after* the page-aligned section, for obvious
  reasons. ]
Signed-off-by: default avatarShaohua Li <shaohua.li@intel.com>
LKML-Reference: <1287544022.4571.7.camel@sli10-conroe.sh.intel.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent f01f7c56
...@@ -677,7 +677,9 @@ ...@@ -677,7 +677,9 @@
- LOAD_OFFSET) { \ - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__per_cpu_start) = .; \ VMLINUX_SYMBOL(__per_cpu_start) = .; \
*(.data..percpu..first) \ *(.data..percpu..first) \
. = ALIGN(PAGE_SIZE); \
*(.data..percpu..page_aligned) \ *(.data..percpu..page_aligned) \
*(.data..percpu..readmostly) \
*(.data..percpu) \ *(.data..percpu) \
*(.data..percpu..shared_aligned) \ *(.data..percpu..shared_aligned) \
VMLINUX_SYMBOL(__per_cpu_end) = .; \ VMLINUX_SYMBOL(__per_cpu_end) = .; \
...@@ -703,6 +705,8 @@ ...@@ -703,6 +705,8 @@
VMLINUX_SYMBOL(__per_cpu_load) = .; \ VMLINUX_SYMBOL(__per_cpu_load) = .; \
VMLINUX_SYMBOL(__per_cpu_start) = .; \ VMLINUX_SYMBOL(__per_cpu_start) = .; \
*(.data..percpu..first) \ *(.data..percpu..first) \
. = ALIGN(PAGE_SIZE); \
*(.data..percpu..readmostly) \
*(.data..percpu..page_aligned) \ *(.data..percpu..page_aligned) \
*(.data..percpu) \ *(.data..percpu) \
*(.data..percpu..shared_aligned) \ *(.data..percpu..shared_aligned) \
......
...@@ -138,6 +138,15 @@ ...@@ -138,6 +138,15 @@
DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \ DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \
__aligned(PAGE_SIZE) __aligned(PAGE_SIZE)
/*
* Declaration/definition used for per-CPU variables that must be read mostly.
*/
#define DECLARE_PER_CPU_READ_MOSTLY(type, name) \
DECLARE_PER_CPU_SECTION(type, name, "..readmostly")
#define DEFINE_PER_CPU_READ_MOSTLY(type, name) \
DEFINE_PER_CPU_SECTION(type, name, "..readmostly")
/* /*
* Intermodule exports for per-CPU variables. sparse forgets about * Intermodule exports for per-CPU variables. sparse forgets about
* address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment