diff options
Diffstat (limited to 'mm')
-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] = |