Re: [PATCH 20/33] dma-mapping: clear harmful GFP_* flags in common code

From
Robin Murphy <robin.murphy@arm.com>
Date
2018-01-10 11:59:39
Also in
linux-alpha, linux-arch, linux-arm-kernel, linux-iommu, linux-mips, linux-s390, linux-sh, lkml, sparclinux
Reply to
Christoph Hellwig, 2018-01-10
On 10/01/18 08:00, Christoph Hellwig wrote:
[...]
quoted hunk ↗ jump to hunk
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 9f28b2fa329e..88bcb1a8211d 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
  	if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
  		return cpu_addr;
  
+	/*
+	 * Let the implementation decide on the zone to allocate from, and
+	 * decide on the way of zeroing the memory given that the memory
+	 * returned should always be zeroed.
+	 */
Just a note that if we're all happy to enshrine the "allocations are always zeroed" behaviour in the API (I am too, for the record), we should remember to follow up once the dust settles to update the docs and I guess just #define dma_zalloc_coherent dma_alloc_coherent.

Robin.
quoted hunk ↗ jump to hunk
+	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
+
  	if (!arch_dma_alloc_attrs(&dev, &flag))
  		return NULL;
  	if (!ops->alloc)
Thread (53 messages) 53 messages, 4 authors, last reply 2018-01-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help