aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/mm/init.c
diff options
context:
space:
mode:
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)