mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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>
This commit is contained in:
parent
55ac590c2f
commit
b2f3eebe7a
@ -5018,9 +5018,33 @@ static void __init find_zone_movable_pfns_for_nodes(void)
|
||||
nodemask_t saved_node_state = node_states[N_MEMORY];
|
||||
unsigned long totalpages = early_calculate_totalpages();
|
||||
int usable_nodes = nodes_weight(node_states[N_MEMORY]);
|
||||
struct memblock_type *type = &memblock.memory;
|
||||
|
||||
/* Need to find movable_zone earlier when movable_node is specified. */
|
||||
find_usable_zone_for_movable();
|
||||
|
||||
/*
|
||||
* If movablecore was specified, calculate what size of
|
||||
* If movable_node is specified, ignore kernelcore and movablecore
|
||||
* options.
|
||||
*/
|
||||
if (movable_node_is_enabled()) {
|
||||
for (i = 0; i < type->cnt; i++) {
|
||||
if (!memblock_is_hotpluggable(&type->regions[i]))
|
||||
continue;
|
||||
|
||||
nid = type->regions[i].nid;
|
||||
|
||||
usable_startpfn = PFN_DOWN(type->regions[i].base);
|
||||
zone_movable_pfn[nid] = zone_movable_pfn[nid] ?
|
||||
min(usable_startpfn, zone_movable_pfn[nid]) :
|
||||
usable_startpfn;
|
||||
}
|
||||
|
||||
goto out2;
|
||||
}
|
||||
|
||||
/*
|
||||
* If movablecore=nn[KMG] was specified, calculate what size of
|
||||
* kernelcore that corresponds so that memory usable for
|
||||
* any allocation type is evenly spread. If both kernelcore
|
||||
* and movablecore are specified, then the value of kernelcore
|
||||
@ -5046,7 +5070,6 @@ static void __init find_zone_movable_pfns_for_nodes(void)
|
||||
goto out;
|
||||
|
||||
/* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */
|
||||
find_usable_zone_for_movable();
|
||||
usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone];
|
||||
|
||||
restart:
|
||||
@ -5137,6 +5160,7 @@ restart:
|
||||
if (usable_nodes && required_kernelcore > usable_nodes)
|
||||
goto restart;
|
||||
|
||||
out2:
|
||||
/* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
|
||||
for (nid = 0; nid < MAX_NUMNODES; nid++)
|
||||
zone_movable_pfn[nid] =
|
||||
|
Loading…
Reference in New Issue
Block a user