numa: add generic percpu var numa_node_id() implementation
Subsystems (4)
[email protected]
maintainerPATCH 196/203 numa: add generic percpu var numa_node_id() implementation
From: Lee Schermerhorn <[email protected]>
Rework the generic version of the numa_node_id() function to use the new generic percpu variable infrastructure.
Guard the new implementation with a new config option:
CONFIG_USE_PERCPU_NUMA_NODE_ID.
Archs which support this new implemention will default this option to 'y' when NUMA is configured. This config option could be removed if/when all archs switch over to the generic percpu implementation of numa_node_id(). Arch support involves:
1) converting any existing per cpu variable implementations to use this implementation. x86_64 is an instance of such an arch.
2) archs that don't use a per cpu variable for numa_node_id() will need to initialize the new per cpu variable "numa_node" as cpus are brought on-line. ia64 is an example.
3) Defining USE_PERCPU_NUMA_NODE_ID in arch dependent Kconfig--e.g., when NUMA is configured. This is required because I have retained the old implementation by default to allow archs to be modified incrementally, as desired.
Subsequent patches will convert x86_64 and ia64 to use this implemenation.
---
arch/x86/include/asm/topology.h | 4 ++ include/linux/topology.h | 51 +++++++++++++++++++++++++++--- mm/page_alloc.c | 5 ++ 3 files changed, 55 insertions(+), 5 deletions(-)
arch/x86/include/asm/topology.h renamed from arch/x86/include/asm/topology.h~numa-add-generic-percpu-var-numa_node_id-implementation +4 -0
@@ -170,6 +170,10 @@ static inline int numa_node_id(void) {return 0 ; } +/* +* indicate override: +*/ +#define numa_node_id numa_node_idstatic inline int early_cpu_to_node (int cpu) {
include/linux/topology.h renamed from include/linux/topology.h~numa-add-generic-percpu-var-numa_node_id-implementation +46 -5
69 lines not on this page · raw message
mm/page_alloc.c renamed from mm/page_alloc.c~numa-add-generic-percpu-var-numa_node_id-implementation +5 -0
@@ -57,6 +57,11 @@#include <asm/div64.h> #include "internal.h" +#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID +DEFINE_PER_CPU (int, numa_node); +EXPORT_PER_CPU_SYMBOL (numa_node); +#endif +/* * Array of node states. */
_