Skip to contentSkip to conversation

ARM: dma-mapping: Drop GFP_COMP for DMA memory allocations

PATCH In review Hiroshi Doyu 2 participants 2 messages Oct 16, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dma-mapping: Drop GFP_COMP for DMA memory allocations

arm_iommu_alloc_attrs 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.

ref: ea2e7057c0234cfb8b09467d8f137760d371fc72:

ARM: 7172/1: dma: Drop GFP_COMP for DMA memory allocations

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.

---
 arch/arm/mm/dma-mapping.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mm/dma-mapping.c +7 -0
index f5e1a84..955dd3e 100644
@@ -1321,6 +1321,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);
 
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 22 lines · Hiroshi Doyu

arm_iommu_alloc_attrs 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.

ref: ea2e7057c0234cfb8b09467d8f137760d371fc72:

ARM: 7172/1: dma: Drop GFP_COMP for DMA memory allocations

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.

---
 arch/arm/mm/dma-mapping.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mm/dma-mapping.c +0 -0
index f5e1a84..955dd3e 100644

arch/arm/mm/dma-mapping.c static void *arm_iommu_alloc_attrs(struct device *dev, size_t size, · line 1329

Quoted 9 lines
arch/arm/mm/dma-mapping.c +6 -0
@@ -1321,6 +1321,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);

Right, except that we *do* have hugepage support on ARM, so this probably needs fixing properly.

Will