Commit d42d701e authored by Linus Walleij's avatar Linus Walleij
Browse files

dma-buf: heaps: Clear CMA pages with clear_page()



clear_page() translates into memset(*p, 0, PAGE_SIZE) on some
architectures, but on the major architectures it will call
an optimized assembly snippet so use this instead of open
coding a memset().

Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarNirmoy Das <nirmoyd@nvidia.com>
Reviewed-by: default avatarT.J. Mercier <tjmercier@google.com>
Signed-off-by: default avatarLinus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20251130-dma-buf-heap-clear-page-v1-1-a8dcea2a88ee@linaro.org
parent 6a0b99e9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ static struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
		while (nr_clear_pages > 0) {
			void *vaddr = kmap_local_page(page);

			memset(vaddr, 0, PAGE_SIZE);
			clear_page(vaddr);
			kunmap_local(vaddr);
			/*
			 * Avoid wasting time zeroing memory if the process