diff options
Diffstat (limited to 'arch/i386/mm/discontig.c')
-rw-r--r-- | arch/i386/mm/discontig.c | 74 |
1 files changed, 22 insertions, 52 deletions
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index fb5d8b747de4..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. */ | ||
161 | int 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); |
@@ -322,6 +310,11 @@ unsigned long __init setup_memory(void) | |||
322 | highstart_pfn = system_max_low_pfn; | 310 | highstart_pfn = system_max_low_pfn; |
323 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | 311 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", |
324 | pages_to_mb(highend_pfn - highstart_pfn)); | 312 | pages_to_mb(highend_pfn - highstart_pfn)); |
313 | num_physpages = highend_pfn; | ||
314 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
315 | #else | ||
316 | num_physpages = system_max_low_pfn; | ||
317 | high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1; | ||
325 | #endif | 318 | #endif |
326 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", | 319 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", |
327 | pages_to_mb(system_max_low_pfn)); | 320 | pages_to_mb(system_max_low_pfn)); |
@@ -364,45 +357,22 @@ void __init numa_kva_reserve(void) | |||
364 | void __init zone_sizes_init(void) | 357 | void __init zone_sizes_init(void) |
365 | { | 358 | { |
366 | int nid; | 359 | int nid; |
367 | 360 | unsigned long max_zone_pfns[MAX_NR_ZONES] = { | |
368 | 361 | virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT, | |
369 | for_each_online_node(nid) { | 362 | max_low_pfn, |
370 | unsigned long zones_size[MAX_NR_ZONES] = {0, }; | 363 | highend_pfn |
371 | unsigned long *zholes_size; | 364 | }; |
372 | unsigned int max_dma; | 365 | |
373 | 366 | /* If SRAT has not registered memory, register it now */ | |
374 | unsigned long low = max_low_pfn; | 367 | if (find_max_pfn_with_active_regions() == 0) { |
375 | unsigned long start = node_start_pfn[nid]; | 368 | for_each_online_node(nid) { |
376 | unsigned long high = node_end_pfn[nid]; | 369 | if (node_has_online_mem(nid)) |
377 | 370 | add_active_range(nid, node_start_pfn[nid], | |
378 | max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; | 371 | node_end_pfn[nid]); |
379 | |||
380 | if (node_has_online_mem(nid)){ | ||
381 | if (start > low) { | ||
382 | #ifdef CONFIG_HIGHMEM | ||
383 | BUG_ON(start > high); | ||
384 | zones_size[ZONE_HIGHMEM] = high - start; | ||
385 | #endif | ||
386 | } else { | ||
387 | if (low < max_dma) | ||
388 | zones_size[ZONE_DMA] = low; | ||
389 | else { | ||
390 | BUG_ON(max_dma > low); | ||
391 | BUG_ON(low > high); | ||
392 | zones_size[ZONE_DMA] = max_dma; | ||
393 | zones_size[ZONE_NORMAL] = low - max_dma; | ||
394 | #ifdef CONFIG_HIGHMEM | ||
395 | zones_size[ZONE_HIGHMEM] = high - low; | ||
396 | #endif | ||
397 | } | ||
398 | } | ||
399 | } | 372 | } |
400 | |||
401 | zholes_size = get_zholes_size(nid); | ||
402 | |||
403 | free_area_init_node(nid, NODE_DATA(nid), zones_size, start, | ||
404 | zholes_size); | ||
405 | } | 373 | } |
374 | |||
375 | free_area_init_nodes(max_zone_pfns); | ||
406 | return; | 376 | return; |
407 | } | 377 | } |
408 | 378 | ||