ARM: dma: Drop GFP_COMP for DMA-IOMMU memory allocations
Hiroshi Doyu [Mon, 2 Apr 2012 07:42:02 +0000 (10:42 +0300)]
dma_alloc_coherent 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.

This patch is ported from arch/avr32
(commit 3611553ef985ef7c5863c8a94641738addd04cff).

Change-Id: I67eb2b15807c36c6a3ade95ee35bf5856d8e0e11
Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>

Rebase-Id: Rf13a569ebe836d341cf4d9287ff4b4711dde85cc

arch/arm/mm/dma-mapping.c

index ef3e0f3..2d0a5a6 100644 (file)
@@ -1308,6 +1308,13 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,
        struct page **pages;
        void *addr = NULL;
 
+       /* 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_HUGETLB_PAGE. */
+       gfp &= ~(__GFP_COMP);
+
        *handle = DMA_ERROR_CODE;
        size = PAGE_ALIGN(size);