Commit 20b2f52b73febce476fc9376f0296c1aa0e4f5a7

Authored by Lai Jiangshan
Committed by Linus Torvalds
1 parent 68ae564bba

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>

Showing 4 changed files with 21 additions and 0 deletions Side-by-side Diff

... ... @@ -644,6 +644,9 @@
644 644 #ifdef CONFIG_HIGHMEM
645 645 [N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
646 646 #endif
  647 +#ifdef CONFIG_MOVABLE_NODE
  648 + [N_MEMORY] = _NODE_ATTR(has_memory, N_MEMORY),
  649 +#endif
647 650 [N_CPU] = _NODE_ATTR(has_cpu, N_CPU),
648 651 };
649 652  
... ... @@ -653,6 +656,9 @@
653 656 &node_state_attr[N_NORMAL_MEMORY].attr.attr,
654 657 #ifdef CONFIG_HIGHMEM
655 658 &node_state_attr[N_HIGH_MEMORY].attr.attr,
  659 +#endif
  660 +#ifdef CONFIG_MOVABLE_NODE
  661 + &node_state_attr[N_MEMORY].attr.attr,
656 662 #endif
657 663 &node_state_attr[N_CPU].attr.attr,
658 664 NULL
include/linux/nodemask.h
... ... @@ -380,7 +380,11 @@
380 380 #else
381 381 N_HIGH_MEMORY = N_NORMAL_MEMORY,
382 382 #endif
  383 +#ifdef CONFIG_MOVABLE_NODE
  384 + N_MEMORY, /* The node has memory(regular, high, movable) */
  385 +#else
383 386 N_MEMORY = N_HIGH_MEMORY,
  387 +#endif
384 388 N_CPU, /* The node has one or more cpus */
385 389 NR_NODE_STATES
386 390 };
... ... @@ -143,6 +143,14 @@
143 143 config MEMORY_ISOLATION
144 144 boolean
145 145  
  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 +
146 154 # eventually, we can have this option just 'select SPARSEMEM'
147 155 config MEMORY_HOTPLUG
148 156 bool "Allow for memory hot-add"
... ... @@ -90,6 +90,9 @@
90 90 #ifdef CONFIG_HIGHMEM
91 91 [N_HIGH_MEMORY] = { { [0] = 1UL } },
92 92 #endif
  93 +#ifdef CONFIG_MOVABLE_NODE
  94 + [N_MEMORY] = { { [0] = 1UL } },
  95 +#endif
93 96 [N_CPU] = { { [0] = 1UL } },
94 97 #endif /* NUMA */
95 98 };