]> Pileus Git - ~andy/linux/commitdiff
ARM: dma: Drop __GFP_COMP for iommu dma memory allocations
authorRichard Zhao <rizhao@nvidia.com>
Thu, 20 Jun 2013 12:31:00 +0000 (20:31 +0800)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 28 Jun 2013 13:14:29 +0000 (15:14 +0200)
__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>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
arch/arm/mm/dma-mapping.c

index 97926b1277b2c7be4fc1f5fd3d6b1fc353af5550..22c7d7eb35a0ec43d53ea106320617bdc4ed349d 100644 (file)
@@ -1328,6 +1328,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;