Commit dc382fd5bcca7098a984705ed6ac880f539d068e
Committed by
H. Peter Anvin
1 parent
e5a10c1bd1
Exists in
master
and in
7 other branches
x86, mm: Allow ZONE_DMA to be configurable
ZONE_DMA is unnecessary for a large number of machines that do not require less than 32-bit DMA addressing, e.g. ISA legacy DMA or PCI cards with a restricted DMA address mask. This patch allows users to disable ZONE_DMA for x86 if they know they will not be using such devices with their kernel. This prevents the VM from unnecessarily reserving a ratio of memory (defaulting to 1/256th of system capacity) with lowmem_reserve_ratio for such allocations when it will never be used. Signed-off-by: David Rientjes <rientjes@google.com> Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1105161353560.4353@chino.kir.corp.google.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Showing 3 changed files with 12 additions and 1 deletions Side-by-side Diff
arch/x86/Kconfig
... | ... | @@ -112,7 +112,14 @@ |
112 | 112 | def_bool y |
113 | 113 | |
114 | 114 | config ZONE_DMA |
115 | - def_bool y | |
115 | + bool "DMA memory allocation support" if EXPERT | |
116 | + default y | |
117 | + help | |
118 | + DMA memory allocation support allows devices with less than 32-bit | |
119 | + addressing to allocate within the first 16MB of address space. | |
120 | + Disable if no such devices will be used. | |
121 | + | |
122 | + If unsure, say Y. | |
116 | 123 | |
117 | 124 | config SBUS |
118 | 125 | bool |
arch/x86/mm/init_32.c
... | ... | @@ -678,8 +678,10 @@ |
678 | 678 | { |
679 | 679 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
680 | 680 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
681 | +#ifdef CONFIG_ZONE_DMA | |
681 | 682 | max_zone_pfns[ZONE_DMA] = |
682 | 683 | virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; |
684 | +#endif | |
683 | 685 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
684 | 686 | #ifdef CONFIG_HIGHMEM |
685 | 687 | max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; |
arch/x86/mm/init_64.c
... | ... | @@ -616,7 +616,9 @@ |
616 | 616 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
617 | 617 | |
618 | 618 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
619 | +#ifdef CONFIG_ZONE_DMA | |
619 | 620 | max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; |
621 | +#endif | |
620 | 622 | max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; |
621 | 623 | max_zone_pfns[ZONE_NORMAL] = max_pfn; |
622 | 624 |