Re: [PATCH for-next 3/3] RDMA/erdma: Remove unnecessary __GFP_ZERO flag

Leon Romanovsky
2024-03-13T09:31:58Z

On Wed, Mar 13, 2024 at 10:40:06AM +0800, Boshi Yu wrote:
> On Tue, Mar 12, 2024 at 12:53:05PM +0200, Leon Romanovsky wrote:
> > On Mon, Mar 11, 2024 at 07:38:21PM +0800, Boshi Yu wrote:
> > > From: Boshi Yu <boshiyu@linux.alibaba.com>
> > >
> > > The dma_alloc_coherent() interface automatically zero the memory returned.
> >
> > Can you please point to the DMA code which does that?
>
> We have noticed a patchset which ensures that dma_alloc_coherent() always
> returns zeroed memory. The url of this patchset is listed as below:
> https://lore.kernel.org/all/20181214082515.14835-1-hch@lst.de/T/#m70c723c646004445713f31b7837f7e9d910c06f5
>
> Besides, you may refer to commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*")
> for details. This commit zeros memory by passing __GFP_ZERO flag or
> calling memset internally. For example, the dma_alloc_direct() interface
> calls memset() to zero the allocated memory.

Thanks