NUMA Hotplug emulator
Subsystems (3)
PATCH v2 2/8 NUMA Hotplug emulator
From: Haicheng Li <[email protected]>
Subject: hotplug emulator: infrastructure of NUMA hotplug emulation
NUMA hotplug emulator introduces a new node state N_HIDDEN to identify the fake offlined node. It firstly hides RAM via E820 table and then emulates fake offlined nodes with the hidden RAM.
After system bootup, user is able to hotplug-add these offlined nodes, which is just similar to a real hardware hotplug behavior.
Using boot option "numa=hide=N*size" to fake offlined nodes:
- N is the number of hidden nodes
- size is the memory size (in MB) per hidden node.
OPEN: Kernel might use part of hidden memory region as RAM buffer,
now emulator directly hide 128M extra space to workaround this issue. Any better way to avoid this conflict?
---
arch/x86/include/asm/numa_64.h +1 -1
@@ -37,7 +37,7 @@ extern void __cpuinit numa_clear_node(int cpu);extern void __cpuinit numa_add_cpu (int cpu);extern void __cpuinit numa_remove_cpu (int cpu); -#ifdef CONFIG_NUMA_EMU +#if defined(CONFIG_NUMA_EMU ) || defined(CONFIG_NODE_HOTPLUG_EMU )#define FAKE_NODE_MIN_SIZE ((u64)64 << 20)#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))#endif /* CONFIG_NUMA_EMU */
arch/x86/mm/numa_64.c +133 -3
172 lines not on this page · raw message
include/linux/nodemask.h +11 -0
@@ -371,6 +371,10 @@ static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,*/ enum node_states {N_POSSIBLE ,/* The node could become online at some point */ +#ifdef CONFIG_NODE_HOTPLUG_EMU +N_HIDDEN ,/* The node is hidden at booting time, could be +* onlined in run time */ +#endif N_ONLINE ,/* The node is online */ N_NORMAL_MEMORY ,/* The node has regular memory */ #ifdef CONFIG_HIGHMEM
@@ -470,6 +474,13 @@ static inline int num_node_state(enum node_states state)#define node_online (node) node_state((node), N_ONLINE)#define node_possible (node) node_state((node), N_POSSIBLE) +#ifdef CONFIG_NODE_HOTPLUG_EMU +#define node_set_hidden (node) node_set_state((node), N_HIDDEN) +#define node_clear_hidden (node) node_clear_state((node), N_HIDDEN) +#define node_hidden (node) node_state((node), N_HIDDEN) +extern int hotadd_hidden_nodes (int nid); +#endif +#define for_each_node (node) for_each_node_state(node, N_POSSIBLE)#define for_each_online_node (node) for_each_node_state(node, N_ONLINE)
Signature · 2 lines
Thanks & Regards, Shaohui
Quoted 19 lines · Shaohui Zheng
include/linux/nodemask.h +4
-0@@ -371,6 +371,10 @@ static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,*/ enum node_states {N_POSSIBLE ,/* The node could become online at some point */ +#ifdef CONFIG_NODE_HOTPLUG_EMU +N_HIDDEN ,/* The node is hidden at booting time, could be +* onlined in run time */ +#endif N_ONLINE ,/* The node is online */ N_NORMAL_MEMORY ,/* The node has regular memory */ #ifdef CONFIG_HIGHMEM @@ -470,6 +474,13 @@ static inline int num_node_state(enum node_states state)#define node_online (node) node_state((node), N_ONLINE)#define node_possible (node) node_state((node), N_POSSIBLE)
include/linux/nodemask.h static inline int num_node_state(enum node_states state) · line 486
Quoted 10 lines
include/linux/nodemask.h +7
-0+#ifdef CONFIG_NODE_HOTPLUG_EMU +#define node_set_hidden (node) node_set_state((node), N_HIDDEN) +#define node_clear_hidden (node) node_clear_state((node), N_HIDDEN) +#define node_hidden (node) node_state((node), N_HIDDEN) +extern int hotadd_hidden_nodes (int nid); +#endif +#define for_each_node (node) for_each_node_state(node, N_POSSIBLE)#define for_each_online_node (node) for_each_node_state(node, N_ONLINE)
None of these really need to be under ifdef. Secondly, the description you have provided is pretty ambiguous in comparison to N_POSSIBLE. Is there some reason you can't just use N_POSSIBLE for this instead?