From: Takashi Iwai <tiwai@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] dma-direct: Don't repeat allocation for no-op GFP_DMA
Date: Sun, 15 Apr 2018 11:08:07 +0200 [thread overview]
Message-ID: <20180415090808.19121-2-tiwai@suse.de> (raw)
In-Reply-To: <20180415090808.19121-1-tiwai@suse.de>
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@suse.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
next prev parent reply other threads:[~2018-04-15 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-15 9:08 [PATCH 0/2] swiotlb: Some regression fixes Takashi Iwai
2018-04-15 9:08 ` Takashi Iwai [this message]
2018-04-23 12:54 ` [PATCH 1/2] dma-direct: Don't repeat allocation for no-op GFP_DMA Christoph Hellwig
2018-04-15 9:08 ` [PATCH 2/2] swiotlb: Fix dma_supported() to consider direct allocation Takashi Iwai
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=20180415090808.19121-2-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®