From: Andi Kleen <andi@firstfloor.org>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] [8/13] Enable the mask allocator for x86
Date: Fri, 7 Mar 2008 10:07:18 +0100 (CET) [thread overview]
Message-ID: <20080307090718.A609E1B419C@basil.firstfloor.org> (raw)
In-Reply-To: <200803071007.493903088@firstfloor.org>
- Disable old ZONE_DMA
No fixed size ZONE_DMA now anymore. All existing users of __GFP_DMA rely
on the compat call to the maskable allocator in alloc/free_pages
- Call maskable allocator initialization functions at boot
- Add TRAD_DMA_MASK for the compat functions
- Remove dma_reserve call
Signed-off-by: Andi Kleen <ak@suse.de>
---
arch/x86/Kconfig | 4 ++--
arch/x86/kernel/setup_32.c | 3 +--
arch/x86/kernel/setup_64.c | 1 +
arch/x86/mm/discontig_32.c | 2 --
arch/x86/mm/init_32.c | 2 ++
arch/x86/mm/init_64.c | 9 ++-------
arch/x86/mm/numa_64.c | 1 -
include/asm-x86/dma.h | 2 ++
8 files changed, 10 insertions(+), 14 deletions(-)
Index: linux/arch/x86/kernel/setup_64.c
===================================================================
--- linux.orig/arch/x86/kernel/setup_64.c
+++ linux/arch/x86/kernel/setup_64.c
@@ -425,6 +425,7 @@ void __init setup_arch(char **cmdline_p)
}
#endif
reserve_crashkernel();
+ init_mask_zone(__pa(MAX_DMA_ADDRESS));
paging_init();
map_vsyscall();
Index: linux/arch/x86/kernel/setup_32.c
===================================================================
--- linux.orig/arch/x86/kernel/setup_32.c
+++ linux/arch/x86/kernel/setup_32.c
@@ -438,8 +438,6 @@ void __init zone_sizes_init(void)
{
unsigned long max_zone_pfns[MAX_NR_ZONES];
memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
- max_zone_pfns[ZONE_DMA] =
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
@@ -811,6 +809,7 @@ void __init setup_arch(char **cmdline_p)
* NOTE: at this point the bootmem allocator is fully available.
*/
+ init_mask_zone(__pa(MAX_DMA_ADDRESS));
#ifdef CONFIG_BLK_DEV_INITRD
relocate_initrd();
#endif
Index: linux/arch/x86/mm/init_64.c
===================================================================
--- linux.orig/arch/x86/mm/init_64.c
+++ linux/arch/x86/mm/init_64.c
@@ -50,8 +50,6 @@
const struct dma_mapping_ops *dma_ops;
EXPORT_SYMBOL(dma_ops);
-static unsigned long dma_reserve __initdata;
-
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
/*
@@ -451,7 +449,6 @@ void __init paging_init(void)
unsigned long max_zone_pfns[MAX_NR_ZONES];
memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
- max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
max_zone_pfns[ZONE_NORMAL] = end_pfn;
@@ -514,6 +511,8 @@ void __init mem_init(void)
pci_iommu_alloc();
+ prepare_mask_zone();
+
/* clear_bss() already clear the empty_zero_page */
reservedpages = 0;
@@ -671,10 +670,6 @@ void __init reserve_bootmem_generic(unsi
#else
reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
#endif
- if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
- dma_reserve += len / PAGE_SIZE;
- set_dma_reserve(dma_reserve);
- }
}
int kern_addr_valid(unsigned long addr)
Index: linux/arch/x86/mm/numa_64.c
===================================================================
--- linux.orig/arch/x86/mm/numa_64.c
+++ linux/arch/x86/mm/numa_64.c
@@ -575,7 +575,6 @@ void __init paging_init(void)
unsigned long max_zone_pfns[MAX_NR_ZONES];
memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
- max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
max_zone_pfns[ZONE_NORMAL] = end_pfn;
Index: linux/arch/x86/Kconfig
===================================================================
--- linux.orig/arch/x86/Kconfig
+++ linux/arch/x86/Kconfig
@@ -63,8 +63,8 @@ config FAST_CMPXCHG_LOCAL
config MMU
def_bool y
-config ZONE_DMA
- def_bool y
+config MASK_ALLOC
+ def_bool y
config QUICKLIST
def_bool X86_32
Index: linux/arch/x86/mm/discontig_32.c
===================================================================
--- linux.orig/arch/x86/mm/discontig_32.c
+++ linux/arch/x86/mm/discontig_32.c
@@ -400,8 +400,6 @@ void __init zone_sizes_init(void)
int nid;
unsigned long max_zone_pfns[MAX_NR_ZONES];
memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
- max_zone_pfns[ZONE_DMA] =
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
Index: linux/include/asm-x86/dma.h
===================================================================
--- linux.orig/include/asm-x86/dma.h
+++ linux/include/asm-x86/dma.h
@@ -316,4 +316,6 @@ extern int isa_dma_bridge_buggy;
#define isa_dma_bridge_buggy (0)
#endif
+#define TRAD_DMA_MASK 0xffffff /* 16MB, 24bit */
+
#endif /* _ASM_X86_DMA_H */
Index: linux/arch/x86/mm/init_32.c
===================================================================
--- linux.orig/arch/x86/mm/init_32.c
+++ linux/arch/x86/mm/init_32.c
@@ -571,6 +571,8 @@ void __init mem_init(void)
int codesize, reservedpages, datasize, initsize;
int tmp, bad_ppro;
+ prepare_mask_zone();
+
#ifdef CONFIG_FLATMEM
BUG_ON(!mem_map);
#endif
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-03-07 9:07 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-07 9:07 [PATCH] [0/13] General DMA zone rework Andi Kleen
2008-03-07 9:07 ` [PATCH] [2/13] Make get_order(0) return 0 Andi Kleen
2008-03-07 9:07 ` [PATCH] [3/13] Make kvm bad_page symbol static Andi Kleen
2008-03-07 9:07 ` [PATCH] [4/13] Prepare page_alloc for the maskable allocator Andi Kleen
2008-03-07 18:19 ` Sam Ravnborg
2008-03-07 18:36 ` Cyrill Gorcunov
2008-03-07 19:02 ` Andi Kleen
2008-03-07 9:07 ` [PATCH] [5/13] Add mask allocator statistics to vmstat.[ch] Andi Kleen
2008-03-08 2:24 ` Christoph Lameter
2008-03-07 9:07 ` [PATCH] [6/13] Core maskable allocator Andi Kleen
2008-03-07 10:53 ` Johannes Weiner
2008-03-07 11:14 ` Andi Kleen
2008-03-07 17:05 ` Randy Dunlap
2008-03-07 17:31 ` Andi Kleen
2008-03-07 17:33 ` Randy Dunlap
2008-03-07 17:43 ` Andi Kleen
2008-03-07 17:51 ` Randy Dunlap
2008-03-07 21:13 ` Cyrill Gorcunov
2008-03-07 23:28 ` Andi Kleen
2008-03-08 5:03 ` KAMEZAWA Hiroyuki
2008-03-08 5:41 ` KAMEZAWA Hiroyuki
2008-03-08 11:41 ` Andi Kleen
2008-03-11 15:34 ` Jonathan Corbet
2008-03-11 15:54 ` Andi Kleen
2008-03-07 9:07 ` [PATCH] [7/13] Implement compat hooks for GFP_DMA Andi Kleen
2008-03-07 9:07 ` Andi Kleen [this message]
2008-03-07 18:32 ` [PATCH] [8/13] Enable the mask allocator for x86 Sam Ravnborg
2008-03-07 19:03 ` Andi Kleen
2008-03-07 19:09 ` Sam Ravnborg
2008-03-08 2:37 ` Christoph Lameter
2008-03-08 6:35 ` Yinghai Lu
2008-03-08 7:31 ` Christoph Lameter
2008-03-08 11:54 ` Andi Kleen
2008-03-10 17:13 ` Christoph Lameter
2008-03-07 9:07 ` [PATCH] [9/13] Remove set_dma_reserve Andi Kleen
2008-03-07 9:07 ` [PATCH] [10/13] Switch the 32bit dma_alloc_coherent functions over to use the maskable allocator Andi Kleen
2008-03-07 9:07 ` [PATCH] [11/13] Switch x86-64 dma_alloc_coherent over to " Andi Kleen
2008-03-07 9:07 ` [PATCH] [12/13] Add vmstat statistics for new swiotlb code Andi Kleen
2008-03-08 2:38 ` Christoph Lameter
2008-03-07 9:07 ` [PATCH] [13/13] Convert x86-64 swiotlb to use the mask allocator directly Andi Kleen
2008-03-07 15:18 ` [PATCH] [0/13] General DMA zone rework Rene Herman
2008-03-07 15:22 ` Rene Herman
2008-03-07 15:31 ` Andi Kleen
2008-03-07 15:34 ` Andi Kleen
2008-03-07 20:51 ` Luiz Fernando N. Capitulino
2008-03-08 0:46 ` Andi Kleen
2008-03-10 18:03 ` Luiz Fernando N. Capitulino
2008-03-10 18:08 ` Andi Kleen
2008-03-11 17:26 ` Luiz Fernando N. Capitulino
2008-03-11 17:35 ` Andi Kleen
2008-03-11 18:00 ` Luiz Fernando N. Capitulino
2008-03-11 18:49 ` Andi Kleen
2008-03-11 19:36 ` Luiz Fernando N. Capitulino
2008-03-08 2:42 ` Christoph Lameter
2008-03-08 11:57 ` Andi Kleen
2008-03-10 17:14 ` Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080307090718.A609E1B419C@basil.firstfloor.org \
--to=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox