Skip to contentSkip to conversation

linux/x86: fix GFP mask handling in dma_alloc_coherent()

PATCH New Jan Beulich 1 participant 1 message Oct 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/x86: fix GFP mask handling in dma_alloc_coherent()

Ever since no longer pushing all memory into the DMA zone (c/s 355), explicitly setting GFP_DMA as well as not masking off GFP_DMA32 was unnecessarily restricting the pool from which suitable memory could be taken.

arch/i386/kernel/pci-dma-xen.c +1 -4
@@ -198,7 +198,7 @@ void *dma_alloc_coherent(struct device *
 	u64 mask;
 
 	/* ignore region specifiers */
-	gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
+	gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
 
 	if (mem) {
 		int page = bitmap_find_free_region(mem->bitmap, mem->size,
@@ -213,9 +213,6 @@ void *dma_alloc_coherent(struct device *
 			return NULL;
 	}
 
-	if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
-		gfp |= GFP_DMA;
-
 	vstart = __get_free_pages(gfp, order);
 	ret = (void *)vstart;