Skip to content

Commit 20b2f52

Browse files
Lai Jiangshantorvalds
authored andcommitted
numa: add CONFIG_MOVABLE_NODE for movable-dedicated node
We need a node which only contains movable memory. This feature is very important for node hotplug. If a node has normal/highmem, the memory may be used by the kernel and can't be offlined. If the node only contains movable memory, we can offline the memory and the node. All are prepared, we can actually introduce N_MEMORY. add CONFIG_MOVABLE_NODE make we can use it for movable-dedicated node [akpm@linux-foundation.org: fix Kconfig text] Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Tested-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Cc: Jiang Liu <jiang.liu@huawei.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Mel Gorman <mgorman@suse.de> Cc: David Rientjes <rientjes@google.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 68ae564 commit 20b2f52

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎drivers/base/node.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ static struct node_attr node_state_attr[] = {
643643
[N_NORMAL_MEMORY] = _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY),
644644
#ifdef CONFIG_HIGHMEM
645645
[N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
646+
#endif
647+
#ifdef CONFIG_MOVABLE_NODE
648+
[N_MEMORY] = _NODE_ATTR(has_memory, N_MEMORY),
646649
#endif
647650
[N_CPU] = _NODE_ATTR(has_cpu, N_CPU),
648651
};
@@ -653,6 +656,9 @@ static struct attribute *node_state_attrs[] = {
653656
&node_state_attr[N_NORMAL_MEMORY].attr.attr,
654657
#ifdef CONFIG_HIGHMEM
655658
&node_state_attr[N_HIGH_MEMORY].attr.attr,
659+
#endif
660+
#ifdef CONFIG_MOVABLE_NODE
661+
&node_state_attr[N_MEMORY].attr.attr,
656662
#endif
657663
&node_state_attr[N_CPU].attr.attr,
658664
NULL

‎include/linux/nodemask.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ enum node_states {
380380
#else
381381
N_HIGH_MEMORY = N_NORMAL_MEMORY,
382382
#endif
383+
#ifdef CONFIG_MOVABLE_NODE
384+
N_MEMORY, /* The node has memory(regular, high, movable) */
385+
#else
383386
N_MEMORY = N_HIGH_MEMORY,
387+
#endif
384388
N_CPU, /* The node has one or more cpus */
385389
NR_NODE_STATES
386390
};

‎mm/Kconfig‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ config NO_BOOTMEM
143143
config MEMORY_ISOLATION
144144
boolean
145145

146+
config MOVABLE_NODE
147+
boolean "Enable to assign a node which has only movable memory"
148+
depends on HAVE_MEMBLOCK
149+
depends on NO_BOOTMEM
150+
depends on X86_64
151+
depends on NUMA
152+
default y
153+
146154
# eventually, we can have this option just 'select SPARSEMEM'
147155
config MEMORY_HOTPLUG
148156
bool "Allow for memory hot-add"

‎mm/page_alloc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
8989
[N_NORMAL_MEMORY] = { { [0] = 1UL } },
9090
#ifdef CONFIG_HIGHMEM
9191
[N_HIGH_MEMORY] = { { [0] = 1UL } },
92+
#endif
93+
#ifdef CONFIG_MOVABLE_NODE
94+
[N_MEMORY] = { { [0] = 1UL } },
9295
#endif
9396
[N_CPU] = { { [0] = 1UL } },
9497
#endif /* NUMA */

0 commit comments

Comments
 (0)