aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/mm/init.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2005-11-05 11:25:53 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-14 22:55:13 -0500
commite18c6874a505958d153a11f9d6947971c349008a (patch)
tree809d61a9e36f9869d875542c9adce1952e202d4b /arch/x86_64/mm/init.c
parentb0d41693217b3bb5b837940dc7465e82a9d49476 (diff)
[PATCH] x86_64: Account mem_map in VM holes accounting
The VM needs to know about lost memory in zones to accurately balance dirty pages. This patch accounts mem_map in there too, which fixes a constant errror of a few percent. Also some other misc mappings and the kernel text itself are accounted too. Signed-off-by: Andi Kleen <ak@suse.de> 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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index a1ad4cc423a7..2b1d6c382396 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -47,6 +47,8 @@ extern int swiotlb;
47 47
48extern char _stext[]; 48extern char _stext[];
49 49
50static unsigned long dma_reserve __initdata;
51
50DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 52DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
51 53
52/* 54/*
@@ -354,6 +356,21 @@ size_zones(unsigned long *z, unsigned long *h,
354 w += z[i]; 356 w += z[i];
355 h[i] = e820_hole_size(s, w); 357 h[i] = e820_hole_size(s, w);
356 } 358 }
359
360 /* Add the space pace needed for mem_map to the holes too. */
361 for (i = 0; i < MAX_NR_ZONES; i++)
362 h[i] += (z[i] * sizeof(struct page)) / PAGE_SIZE;
363
364 /* The 16MB DMA zone has the kernel and other misc mappings.
365 Account them too */
366 if (h[ZONE_DMA]) {
367 h[ZONE_DMA] += dma_reserve;
368 if (h[ZONE_DMA] >= z[ZONE_DMA]) {
369 printk(KERN_WARNING
370 "Kernel too large and filling up ZONE_DMA?\n");
371 h[ZONE_DMA] = z[ZONE_DMA];
372 }
373 }
357} 374}
358 375
359#ifndef CONFIG_NUMA 376#ifndef CONFIG_NUMA
@@ -510,6 +527,8 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
510#else 527#else
511 reserve_bootmem(phys, len); 528 reserve_bootmem(phys, len);
512#endif 529#endif
530 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE)
531 dma_reserve += len / PAGE_SIZE;
513} 532}
514 533
515int kern_addr_valid(unsigned long addr) 534int kern_addr_valid(unsigned long addr)