Remove bounce_gfp Convert mm/bounce.c to use a mask allocator mempool for ISA DMA memory and then remove bounce_gfp. All bouncing is controlled by bounce_pfn now. The mask allocation pool is currently still ISA_DMA_THRESHOLD max, but that will be relaxed soon. The isa bounce case is checked now for with a new flag. Signed-off-by: Andi Kleen Signed-off-by: Andi Kleen --- block/blk-settings.c | 3 +-- include/linux/blkdev.h | 2 +- mm/bounce.c | 16 ++++------------ 3 files changed, 6 insertions(+), 15 deletions(-) Index: linux/include/linux/blkdev.h =================================================================== --- linux.orig/include/linux/blkdev.h +++ linux/include/linux/blkdev.h @@ -324,7 +324,7 @@ struct request_queue * queue needs bounce pages for pages above this limit */ unsigned long bounce_pfn; - gfp_t bounce_gfp; + unsigned isa : 1; /* * various queue flags, see QUEUE_* below Index: linux/block/blk-settings.c =================================================================== --- linux.orig/block/blk-settings.c +++ linux/block/blk-settings.c @@ -135,7 +135,6 @@ void blk_queue_bounce_limit(struct reque unsigned long b_pfn = dma_addr >> PAGE_SHIFT; int dma = 0; - q->bounce_gfp = GFP_NOIO; #if BITS_PER_LONG == 64 /* Assume anything <= 4GB can be handled by IOMMU. Actually some IOMMUs can handle everything, but I don't @@ -150,8 +149,8 @@ void blk_queue_bounce_limit(struct reque #endif if (dma) { init_emergency_isa_pool(); - q->bounce_gfp = GFP_NOIO | GFP_DMA; q->bounce_pfn = b_pfn; + q->isa = 1; } } EXPORT_SYMBOL(blk_queue_bounce_limit); Index: linux/mm/bounce.c =================================================================== --- linux.orig/mm/bounce.c +++ linux/mm/bounce.c @@ -63,14 +63,6 @@ static void bounce_copy_vec(struct bio_v #endif /* CONFIG_HIGHMEM */ /* - * allocate pages in the DMA region for the ISA pool - */ -static void *mempool_alloc_pages_isa(gfp_t gfp_mask, void *data) -{ - return mempool_alloc_pages(gfp_mask | GFP_DMA, data); -} - -/* * gets called "every" time someone init's a queue with BLK_BOUNCE_ISA * as the max address, so check if the pool has already been created. */ @@ -79,8 +71,8 @@ int init_emergency_isa_pool(void) if (isa_page_pool) return 0; - isa_page_pool = mempool_create(ISA_POOL_SIZE, mempool_alloc_pages_isa, - mempool_free_pages, (void *) 0); + isa_page_pool = mempool_create_pool_pmask(ISA_POOL_SIZE, PAGE_SIZE, + ISA_DMA_THRESHOLD); BUG_ON(!isa_page_pool); printk("isa bounce pool size: %d pages\n", ISA_POOL_SIZE); @@ -200,7 +192,7 @@ static void __blk_queue_bounce(struct re to = bio->bi_io_vec + i; - to->bv_page = mempool_alloc(pool, q->bounce_gfp); + to->bv_page = mempool_alloc(pool, GFP_NOIO); to->bv_len = from->bv_len; to->bv_offset = from->bv_offset; inc_zone_page_state(to->bv_page, NR_BOUNCE); @@ -275,7 +267,7 @@ void blk_queue_bounce(struct request_que * to or bigger than the highest pfn in the system -- in that case, * don't waste time iterating over bio segments */ - if (!(q->bounce_gfp & GFP_DMA)) { + if (!q->isa) { if (q->bounce_pfn >= blk_max_pfn) return; pool = page_pool;