diff options
author | Tang Chen <tangchen@cn.fujitsu.com> | 2014-01-21 18:49:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 19:19:45 -0500 |
commit | b2f3eebe7a8ef6cd4e2ea088ac7f613793f6cad6 (patch) | |
tree | 7fdb95a26a016685c0813fe047f6f1472109cbc4 /mm/page_alloc.c | |
parent | 55ac590c2fadad785d60dd70c12d62823bc2cd39 (diff) |
x86, numa, acpi, memory-hotplug: make movable_node have higher priority
If users specify the original movablecore=nn@ss boot option, the kernel
will arrange [ss, ss+nn) as ZONE_MOVABLE. The kernelcore=nn@ss boot
option is similar except it specifies ZONE_NORMAL ranges.
Now, if users specify "movable_node" in kernel commandline, the kernel
will arrange hotpluggable memory in SRAT as ZONE_MOVABLE. And if users
do this, all the other movablecore=nn@ss and kernelcore=nn@ss options
should be ignored.
For those who don't want this, just specify nothing. The kernel will
act as before.
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Rafael J . Wysocki" <rjw@sisk.pl>
Cc: Chen Tang <imtangchen@gmail.com>
Cc: Gong Chen <gong.chen@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Liu Jiang <jiang.liu@huawei.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ec4417cb458a..4f59d1986018 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -5018,9 +5018,33 @@ static void __init find_zone_movable_pfns_for_nodes(void) | |||
5018 | nodemask_t saved_node_state = node_states[N_MEMORY]; | 5018 | nodemask_t saved_node_state = node_states[N_MEMORY]; |
5019 | unsigned long totalpages = early_calculate_totalpages(); | 5019 | unsigned long totalpages = early_calculate_totalpages(); |
5020 | int usable_nodes = nodes_weight(node_states[N_MEMORY]); | 5020 | int usable_nodes = nodes_weight(node_states[N_MEMORY]); |
5021 | struct memblock_type *type = &memblock.memory; | ||
5022 | |||
5023 | /* Need to find movable_zone earlier when movable_node is specified. */ | ||
5024 | find_usable_zone_for_movable(); | ||
5025 | |||
5026 | /* | ||
5027 | * If movable_node is specified, ignore kernelcore and movablecore | ||
5028 | * options. | ||
5029 | */ | ||
5030 | if (movable_node_is_enabled()) { | ||
5031 | for (i = 0; i < type->cnt; i++) { | ||
5032 | if (!memblock_is_hotpluggable(&type->regions[i])) | ||
5033 | continue; | ||
5034 | |||
5035 | nid = type->regions[i].nid; | ||
5036 | |||
5037 | usable_startpfn = PFN_DOWN(type->regions[i].base); | ||
5038 | zone_movable_pfn[nid] = zone_movable_pfn[nid] ? | ||
5039 | min(usable_startpfn, zone_movable_pfn[nid]) : | ||
5040 | usable_startpfn; | ||
5041 | } | ||
5042 | |||
5043 | goto out2; | ||
5044 | } | ||
5021 | 5045 | ||
5022 | /* | 5046 | /* |
5023 | * If movablecore was specified, calculate what size of | 5047 | * If movablecore=nn[KMG] was specified, calculate what size of |
5024 | * kernelcore that corresponds so that memory usable for | 5048 | * kernelcore that corresponds so that memory usable for |
5025 | * any allocation type is evenly spread. If both kernelcore | 5049 | * any allocation type is evenly spread. If both kernelcore |
5026 | * and movablecore are specified, then the value of kernelcore | 5050 | * and movablecore are specified, then the value of kernelcore |
@@ -5046,7 +5070,6 @@ static void __init find_zone_movable_pfns_for_nodes(void) | |||
5046 | goto out; | 5070 | goto out; |
5047 | 5071 | ||
5048 | /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ | 5072 | /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ |
5049 | find_usable_zone_for_movable(); | ||
5050 | usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; | 5073 | usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; |
5051 | 5074 | ||
5052 | restart: | 5075 | restart: |
@@ -5137,6 +5160,7 @@ restart: | |||
5137 | if (usable_nodes && required_kernelcore > usable_nodes) | 5160 | if (usable_nodes && required_kernelcore > usable_nodes) |
5138 | goto restart; | 5161 | goto restart; |
5139 | 5162 | ||
5163 | out2: | ||
5140 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ | 5164 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ |
5141 | for (nid = 0; nid < MAX_NUMNODES; nid++) | 5165 | for (nid = 0; nid < MAX_NUMNODES; nid++) |
5142 | zone_movable_pfn[nid] = | 5166 | zone_movable_pfn[nid] = |