aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/mm/init.c
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2006-09-27 04:49:52 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:11 -0400
commit5cb248abf5ab65ab543b2d5fc16c738b28031fc0 (patch)
treee9af2f7f86000e36f11f1091cb675c1738d69ca3 /arch/x86_64/mm/init.c
parent4cfee88ad30acc47f02b8b7ba3db8556262dce1e (diff)
[PATCH] Have x86_64 use add_active_range() and free_area_init_nodes
Size zones and holes in an architecture independent manner for x86_64. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Andy Whitcroft <apw@shadowen.org> Cc: Andi Kleen <ak@muc.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: "Keith Mannthey" <kmannth@gmail.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Yasunori Goto <y-goto@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/mm/init.c')
-rw-r--r--arch/x86_64/mm/init.c65
1 files changed, 6 insertions, 59 deletions
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 1e4669fa573..47928399e38 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -403,69 +403,15 @@ void __cpuinit zap_low_mappings(int cpu)
403 __flush_tlb_all(); 403 __flush_tlb_all();
404} 404}
405 405
406/* Compute zone sizes for the DMA and DMA32 zones in a node. */
407__init void
408size_zones(unsigned long *z, unsigned long *h,
409 unsigned long start_pfn, unsigned long end_pfn)
410{
411 int i;
412 unsigned long w;
413
414 for (i = 0; i < MAX_NR_ZONES; i++)
415 z[i] = 0;
416
417 if (start_pfn < MAX_DMA_PFN)
418 z[ZONE_DMA] = MAX_DMA_PFN - start_pfn;
419 if (start_pfn < MAX_DMA32_PFN) {
420 unsigned long dma32_pfn = MAX_DMA32_PFN;
421 if (dma32_pfn > end_pfn)
422 dma32_pfn = end_pfn;
423 z[ZONE_DMA32] = dma32_pfn - start_pfn;
424 }
425 z[ZONE_NORMAL] = end_pfn - start_pfn;
426
427 /* Remove lower zones from higher ones. */
428 w = 0;
429 for (i = 0; i < MAX_NR_ZONES; i++) {
430 if (z[i])
431 z[i] -= w;
432 w += z[i];
433 }
434
435 /* Compute holes */
436 w = start_pfn;
437 for (i = 0; i < MAX_NR_ZONES; i++) {
438 unsigned long s = w;
439 w += z[i];
440 h[i] = e820_hole_size(s, w);
441 }
442
443 /* Add the space pace needed for mem_map to the holes too. */
444 for (i = 0; i < MAX_NR_ZONES; i++)
445 h[i] += (z[i] * sizeof(struct page)) / PAGE_SIZE;
446
447 /* The 16MB DMA zone has the kernel and other misc mappings.
448 Account them too */
449 if (h[ZONE_DMA]) {
450 h[ZONE_DMA] += dma_reserve;
451 if (h[ZONE_DMA] >= z[ZONE_DMA]) {
452 printk(KERN_WARNING
453 "Kernel too large and filling up ZONE_DMA?\n");
454 h[ZONE_DMA] = z[ZONE_DMA];
455 }
456 }
457}
458
459#ifndef CONFIG_NUMA 406#ifndef CONFIG_NUMA
460void __init paging_init(void) 407void __init paging_init(void)
461{ 408{
462 unsigned long zones[MAX_NR_ZONES], holes[MAX_NR_ZONES]; 409 unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
463 410 MAX_DMA32_PFN,
411 end_pfn};
464 memory_present(0, 0, end_pfn); 412 memory_present(0, 0, end_pfn);
465 sparse_init(); 413 sparse_init();
466 size_zones(zones, holes, 0, end_pfn); 414 free_area_init_nodes(max_zone_pfns);
467 free_area_init_node(0, NODE_DATA(0), zones,
468 __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes);
469} 415}
470#endif 416#endif
471 417
@@ -608,7 +554,8 @@ void __init mem_init(void)
608#else 554#else
609 totalram_pages = free_all_bootmem(); 555 totalram_pages = free_all_bootmem();
610#endif 556#endif
611 reservedpages = end_pfn - totalram_pages - e820_hole_size(0, end_pfn); 557 reservedpages = end_pfn - totalram_pages -
558 absent_pages_in_range(0, end_pfn);
612 559
613 after_bootmem = 1; 560 after_bootmem = 1;
614 561