aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mm/discontig.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/mm/discontig.c')
-rw-r--r--arch/i386/mm/discontig.c69
1 files changed, 17 insertions, 52 deletions
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index 941d1a5ebabb..51e3739dd227 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -157,21 +157,6 @@ static void __init find_max_pfn_node(int nid)
157 BUG(); 157 BUG();
158} 158}
159 159
160/* Find the owning node for a pfn. */
161int early_pfn_to_nid(unsigned long pfn)
162{
163 int nid;
164
165 for_each_node(nid) {
166 if (node_end_pfn[nid] == 0)
167 break;
168 if (node_start_pfn[nid] <= pfn && node_end_pfn[nid] >= pfn)
169 return nid;
170 }
171
172 return 0;
173}
174
175/* 160/*
176 * Allocate memory for the pg_data_t for this node via a crude pre-bootmem 161 * Allocate memory for the pg_data_t for this node via a crude pre-bootmem
177 * method. For node zero take this from the bottom of memory, for 162 * method. For node zero take this from the bottom of memory, for
@@ -227,6 +212,8 @@ static unsigned long calculate_numa_remap_pages(void)
227 unsigned long pfn; 212 unsigned long pfn;
228 213
229 for_each_online_node(nid) { 214 for_each_online_node(nid) {
215 unsigned old_end_pfn = node_end_pfn[nid];
216
230 /* 217 /*
231 * The acpi/srat node info can show hot-add memroy zones 218 * The acpi/srat node info can show hot-add memroy zones
232 * where memory could be added but not currently present. 219 * where memory could be added but not currently present.
@@ -276,6 +263,7 @@ static unsigned long calculate_numa_remap_pages(void)
276 263
277 node_end_pfn[nid] -= size; 264 node_end_pfn[nid] -= size;
278 node_remap_start_pfn[nid] = node_end_pfn[nid]; 265 node_remap_start_pfn[nid] = node_end_pfn[nid];
266 shrink_active_range(nid, old_end_pfn, node_end_pfn[nid]);
279 } 267 }
280 printk("Reserving total of %ld pages for numa KVA remap\n", 268 printk("Reserving total of %ld pages for numa KVA remap\n",
281 reserve_pages); 269 reserve_pages);
@@ -369,45 +357,22 @@ void __init numa_kva_reserve(void)
369void __init zone_sizes_init(void) 357void __init zone_sizes_init(void)
370{ 358{
371 int nid; 359 int nid;
372 360 unsigned long max_zone_pfns[MAX_NR_ZONES] = {
373 361 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
374 for_each_online_node(nid) { 362 max_low_pfn,
375 unsigned long zones_size[MAX_NR_ZONES] = {0, }; 363 highend_pfn
376 unsigned long *zholes_size; 364 };
377 unsigned int max_dma; 365
378 366 /* If SRAT has not registered memory, register it now */
379 unsigned long low = max_low_pfn; 367 if (find_max_pfn_with_active_regions() == 0) {
380 unsigned long start = node_start_pfn[nid]; 368 for_each_online_node(nid) {
381 unsigned long high = node_end_pfn[nid]; 369 if (node_has_online_mem(nid))
382 370 add_active_range(nid, node_start_pfn[nid],
383 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; 371 node_end_pfn[nid]);
384
385 if (node_has_online_mem(nid)){
386 if (start > low) {
387#ifdef CONFIG_HIGHMEM
388 BUG_ON(start > high);
389 zones_size[ZONE_HIGHMEM] = high - start;
390#endif
391 } else {
392 if (low < max_dma)
393 zones_size[ZONE_DMA] = low;
394 else {
395 BUG_ON(max_dma > low);
396 BUG_ON(low > high);
397 zones_size[ZONE_DMA] = max_dma;
398 zones_size[ZONE_NORMAL] = low - max_dma;
399#ifdef CONFIG_HIGHMEM
400 zones_size[ZONE_HIGHMEM] = high - low;
401#endif
402 }
403 }
404 } 372 }
405
406 zholes_size = get_zholes_size(nid);
407
408 free_area_init_node(nid, NODE_DATA(nid), zones_size, start,
409 zholes_size);
410 } 373 }
374
375 free_area_init_nodes(max_zone_pfns);
411 return; 376 return;
412} 377}
413 378