[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180415090808.19121-2-tiwai@suse.de>
Date: Sun, 15 Apr 2018 11:08:07 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Christoph Hellwig <hch@....de>
Cc: iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] dma-direct: Don't repeat allocation for no-op GFP_DMA
When an allocation with lower dma_coherent mask fails,
dma_direct_alloc() retries the allocation with GFP_DMA. But, it's
useless for architectures that has no ZONE_DMA, obviously.
Fix it by adding the check of CONFIG_ZONE_DMA before retrying the
allocation.
Fixes: 95f183916d4b ("dma-direct: retry allocations using GFP_DMA for small masks")
Signed-off-by: Takashi Iwai <tiwai@...e.de>
---
lib/dma-direct.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index c0bba30fef0a..bbfb229aa067 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -84,7 +84,8 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
__free_pages(page, page_order);
page = NULL;
- if (dev->coherent_dma_mask < DMA_BIT_MASK(32) &&
+ if (IS_ENABLED(CONFIG_ZONE_DMA) &&
+ dev->coherent_dma_mask < DMA_BIT_MASK(32) &&
!(gfp & GFP_DMA)) {
gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
goto again;
--
2.16.3
Powered by blists - more mailing lists