提交 e18c6874 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[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: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b0d41693
...@@ -47,6 +47,8 @@ extern int swiotlb; ...@@ -47,6 +47,8 @@ extern int swiotlb;
extern char _stext[]; extern char _stext[];
static unsigned long dma_reserve __initdata;
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
/* /*
...@@ -354,6 +356,21 @@ size_zones(unsigned long *z, unsigned long *h, ...@@ -354,6 +356,21 @@ size_zones(unsigned long *z, unsigned long *h,
w += z[i]; w += z[i];
h[i] = e820_hole_size(s, w); h[i] = e820_hole_size(s, w);
} }
/* Add the space pace needed for mem_map to the holes too. */
for (i = 0; i < MAX_NR_ZONES; i++)
h[i] += (z[i] * sizeof(struct page)) / PAGE_SIZE;
/* The 16MB DMA zone has the kernel and other misc mappings.
Account them too */
if (h[ZONE_DMA]) {
h[ZONE_DMA] += dma_reserve;
if (h[ZONE_DMA] >= z[ZONE_DMA]) {
printk(KERN_WARNING
"Kernel too large and filling up ZONE_DMA?\n");
h[ZONE_DMA] = z[ZONE_DMA];
}
}
} }
#ifndef CONFIG_NUMA #ifndef CONFIG_NUMA
...@@ -510,6 +527,8 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len) ...@@ -510,6 +527,8 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
#else #else
reserve_bootmem(phys, len); reserve_bootmem(phys, len);
#endif #endif
if (phys+len <= MAX_DMA_PFN*PAGE_SIZE)
dma_reserve += len / PAGE_SIZE;
} }
int kern_addr_valid(unsigned long addr) int kern_addr_valid(unsigned long addr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册