numa: add CONFIG_MOVABLE_NODE for movable-dedicated node
authorLai Jiangshan <laijs@cn.fujitsu.com>
Wed, 12 Dec 2012 21:52:00 +0000 (13:52 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Dec 2012 01:38:34 +0000 (17:38 -0800)
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>
drivers/base/node.c
include/linux/nodemask.h
mm/Kconfig
mm/page_alloc.c

index 49dbe7dc9ada9d5f92141b56d62cfadcabbd24d5..fac124a7e1c5b0203b4953e6fd30ce9fbfe5c290 100644 (file)
@@ -643,6 +643,9 @@ static struct node_attr node_state_attr[] = {
        [N_NORMAL_MEMORY] = _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY),
 #ifdef CONFIG_HIGHMEM
        [N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
+#endif
+#ifdef CONFIG_MOVABLE_NODE
+       [N_MEMORY] = _NODE_ATTR(has_memory, N_MEMORY),
 #endif
        [N_CPU] = _NODE_ATTR(has_cpu, N_CPU),
 };
@@ -653,6 +656,9 @@ static struct attribute *node_state_attrs[] = {
        &node_state_attr[N_NORMAL_MEMORY].attr.attr,
 #ifdef CONFIG_HIGHMEM
        &node_state_attr[N_HIGH_MEMORY].attr.attr,
+#endif
+#ifdef CONFIG_MOVABLE_NODE
+       &node_state_attr[N_MEMORY].attr.attr,
 #endif
        &node_state_attr[N_CPU].attr.attr,
        NULL
index c6ebdc97a428512078e4f51dfaf8eff2577aa0af..4e2cbfa640b7241d0ddf803a68010e20b5991115 100644 (file)
@@ -380,7 +380,11 @@ enum node_states {
 #else
        N_HIGH_MEMORY = N_NORMAL_MEMORY,
 #endif
+#ifdef CONFIG_MOVABLE_NODE
+       N_MEMORY,               /* The node has memory(regular, high, movable) */
+#else
        N_MEMORY = N_HIGH_MEMORY,
+#endif
        N_CPU,          /* The node has one or more cpus */
        NR_NODE_STATES
 };
index e6651c5de14f4e42a0b6455e0d0b0859f06c2680..1680a0123a139dda2a3e229bceeba303f6b43265 100644 (file)
@@ -143,6 +143,14 @@ config NO_BOOTMEM
 config MEMORY_ISOLATION
        boolean
 
+config MOVABLE_NODE
+       boolean "Enable to assign a node which has only movable memory"
+       depends on HAVE_MEMBLOCK
+       depends on NO_BOOTMEM
+       depends on X86_64
+       depends on NUMA
+       default y
+
 # eventually, we can have this option just 'select SPARSEMEM'
 config MEMORY_HOTPLUG
        bool "Allow for memory hot-add"
index 35727168896b0de3dff7041a41daac4c1043f3d9..2bf0d43d646bfdad40d319f8d229c89d187e5e2b 100644 (file)
@@ -89,6 +89,9 @@ nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
        [N_NORMAL_MEMORY] = { { [0] = 1UL } },
 #ifdef CONFIG_HIGHMEM
        [N_HIGH_MEMORY] = { { [0] = 1UL } },
+#endif
+#ifdef CONFIG_MOVABLE_NODE
+       [N_MEMORY] = { { [0] = 1UL } },
 #endif
        [N_CPU] = { { [0] = 1UL } },
 #endif /* NUMA */