linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dma: Drop __GFP_COMP for iommu dma memory allocations
@ 2013-06-20 12:31 Richard Zhao
  2013-06-20 13:04 ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Zhao @ 2013-06-20 12:31 UTC (permalink / raw)
  To: linux-arm-kernel

__iommu_alloc_buffer wants to split pages after allocation in order to
reduce the memory footprint. This does not work well with __GFP_COMP
pages, so drop this flag before allocation

One failure example is snd_malloc_dev_pages call dma_alloc_coherent with
__GFP_COMP.

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
---
 arch/arm/mm/dma-mapping.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ef3e0f3..f7efffd 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1314,6 +1314,15 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,
 	if (gfp & GFP_ATOMIC)
 		return __iommu_alloc_atomic(dev, size, handle);
 
+	/*
+	 * Following is a work-around (a.k.a. hack) to prevent pages
+	 * with __GFP_COMP being passed to split_page() which cannot
+	 * handle them.  The real problem is that this flag probably
+	 * should be 0 on ARM as it is not supported on this
+	 * platform; see CONFIG_HUGETLBFS.
+	 */
+	gfp &= ~(__GFP_COMP);
+
 	pages = __iommu_alloc_buffer(dev, size, gfp, attrs);
 	if (!pages)
 		return NULL;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-21 11:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-20 12:31 [PATCH] ARM: dma: Drop __GFP_COMP for iommu dma memory allocations Richard Zhao
2013-06-20 13:04 ` Sergei Shtylyov
2013-06-20 13:40   ` Richard Zhao
2013-06-20 14:35     ` Hiroshi Doyu
2013-06-21  4:52       ` Richard Zhao
2013-06-21  9:33   ` Marek Szyprowski
2013-06-21 11:04     ` Richard Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).