aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2012-12-12 16:52:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 20:38:34 -0500
commit09285af75d1682d8642607941ca6034ea1b159eb (patch)
tree9b3ad7b48bfc469baee197d2dcf62c245164a0c5 /mm
parent20b2f52b73febce476fc9376f0296c1aa0e4f5a7 (diff)
memory_hotplug: allow online/offline memory to result movable node
Now, memory management can handle movable node or nodes which don't have any normal memory, so we can dynamic configure and add movable node by: online a ZONE_MOVABLE memory from a previous offline node offline the last normal memory which result a non-normal-memory-node movable-node is very important for power-saving, hardware partitioning and high-available-system(hardware fault management). 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>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory_hotplug.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index eca4aac1a83b..c6cd8b515424 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -581,11 +581,19 @@ static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
581 return 0; 581 return 0;
582} 582}
583 583
584#ifdef CONFIG_MOVABLE_NODE
585/* when CONFIG_MOVABLE_NODE, we allow online node don't have normal memory */
586static bool can_online_high_movable(struct zone *zone)
587{
588 return true;
589}
590#else /* #ifdef CONFIG_MOVABLE_NODE */
584/* ensure every online node has NORMAL memory */ 591/* ensure every online node has NORMAL memory */
585static bool can_online_high_movable(struct zone *zone) 592static bool can_online_high_movable(struct zone *zone)
586{ 593{
587 return node_state(zone_to_nid(zone), N_NORMAL_MEMORY); 594 return node_state(zone_to_nid(zone), N_NORMAL_MEMORY);
588} 595}
596#endif /* #ifdef CONFIG_MOVABLE_NODE */
589 597
590/* check which state of node_states will be changed when online memory */ 598/* check which state of node_states will be changed when online memory */
591static void node_states_check_changes_online(unsigned long nr_pages, 599static void node_states_check_changes_online(unsigned long nr_pages,
@@ -1093,6 +1101,13 @@ check_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
1093 return offlined; 1101 return offlined;
1094} 1102}
1095 1103
1104#ifdef CONFIG_MOVABLE_NODE
1105/* when CONFIG_MOVABLE_NODE, we allow online node don't have normal memory */
1106static bool can_offline_normal(struct zone *zone, unsigned long nr_pages)
1107{
1108 return true;
1109}
1110#else /* #ifdef CONFIG_MOVABLE_NODE */
1096/* ensure the node has NORMAL memory if it is still online */ 1111/* ensure the node has NORMAL memory if it is still online */
1097static bool can_offline_normal(struct zone *zone, unsigned long nr_pages) 1112static bool can_offline_normal(struct zone *zone, unsigned long nr_pages)
1098{ 1113{
@@ -1116,6 +1131,7 @@ static bool can_offline_normal(struct zone *zone, unsigned long nr_pages)
1116 */ 1131 */
1117 return present_pages == 0; 1132 return present_pages == 0;
1118} 1133}
1134#endif /* #ifdef CONFIG_MOVABLE_NODE */
1119 1135
1120/* check which state of node_states will be changed when offline memory */ 1136/* check which state of node_states will be changed when offline memory */
1121static void node_states_check_changes_offline(unsigned long nr_pages, 1137static void node_states_check_changes_offline(unsigned long nr_pages,