Skip to contentSkip to conversation

numa: introduce numa_mem_id()- effective local memory node id

PATCH New [email protected] 1 participant 1 message May 26, 2010

Subsystems (5)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 199/203 numa: introduce numa_mem_id()- effective local memory node id

From: Lee Schermerhorn <[email protected]>

Introduce numa_mem_id(), based on generic percpu variable infrastructure to track "nearest node with memory" for archs that support memoryless nodes.

Define API in <linux/topology.h> when CONFIG_HAVE_MEMORYLESS_NODES defined, else stubs. Architectures will define HAVE_MEMORYLESS_NODES if/when they support them.

Archs can override definitions of:

numa_mem_id() - returns node number of "local memory" node set_numa_mem() - initialize [this cpus'] per cpu variable 'numa_mem' cpu_to_mem() - return numa_mem for specified cpu; may be used as lvalue

Generic initialization of 'numa_mem' occurs in __build_all_zonelists(). This will initialize the boot cpu at boot time, and all cpus on change of numa_zonelist_order, or when node or memory hot-plug requires zonelist rebuild. Archs that support memoryless nodes will need to initialize 'numa_mem' for secondary cpus as they're brought on-line.

[[email protected]: fix build]
Cc Tejun Heo <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Nick Piggin <[email protected]>
Cc David Rientjes <[email protected]>
Cc Eric Whitney <[email protected]>
Cc KAMEZAWA Hiroyuki <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc "Luck, Tony" <[email protected]>
Cc Pekka Enberg <[email protected]>

---

 include/asm-generic/topology.h |    3 +
 include/linux/mmzone.h         |    6 +++
 include/linux/topology.h       |   61 +++++++++++++++++++++++++++++++
 mm/page_alloc.c                |   45 ++++++++++++++++++++++
 4 files changed, 114 insertions(+), 1 deletion(-)
include/asm-generic/topology.h renamed from include/asm-generic/topology.h~numa-introduce-numa_mem_id-effective-local-memory-node-id +3 -0
diff -puN include/asm-generic/topology.h~numa-introduce-numa_mem_id-effective-local-memory-node-id include/asm-generic/topology.h
@@ -34,6 +34,9 @@
 #ifndef cpu_to_node
 #define cpu_to_node(cpu)	((void)(cpu),0)
 #endif
+#ifndef cpu_to_mem
+#define cpu_to_mem(cpu)		((void)(cpu),0)
+#endif
 #ifndef parent_node
 #define parent_node(node)	((void)(node),0)
 #endif
include/linux/mmzone.h renamed from include/linux/mmzone.h~numa-introduce-numa_mem_id-effective-local-memory-node-id +6 -0
diff -puN include/linux/mmzone.h~numa-introduce-numa_mem_id-effective-local-memory-node-id include/linux/mmzone.h
@@ -671,6 +671,12 @@ void memory_present(int nid, unsigned lo
 static inline void memory_present(int nid, unsigned long start, unsigned long end) {}
 #endif
 
+#ifdef CONFIG_HAVE_MEMORYLESS_NODES
+int local_memory_node(int node_id);
+#else
+static inline int local_memory_node(int node_id) { return node_id; };
+#endif
+
 #ifdef CONFIG_NEED_NODE_MEMMAP_SIZE
 unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
 #endif
include/linux/topology.h renamed from include/linux/topology.h~numa-introduce-numa_mem_id-effective-local-memory-node-id +61 -0

67 lines not on this page · raw message

mm/page_alloc.c renamed from mm/page_alloc.c~numa-introduce-numa_mem_id-effective-local-memory-node-id +44 -1

65 lines not on this page · raw message

_