Thread (53 messages) 53 messages, 4 authors, 2018-01-12

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

From: robin.murphy@arm.com (Robin Murphy)
Date: 2018-01-10 11:59:39
Also in: linux-alpha, linux-arch, linux-iommu, linux-mips, linux-s390, linux-sh, linuxppc-dev, lkml, sparclinux

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.
+	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
+
  	if (!arch_dma_alloc_attrs(&dev, &flag))
  		return NULL;
  	if (!ops->alloc)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help