summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Walleij <linusw@kernel.org>2026-03-10 11:53:11 +0300
committerLinus Walleij <linusw@kernel.org>2026-03-11 12:06:13 +0300
commite669d2f601919aedc6cadca673109684aa499326 (patch)
treec9fa820c6905450e67dc96a5162c4981a5d85362
parentdfda8e9a282d3affbd64df3483e1bb8a5e0b015d (diff)
downloadlinux-e669d2f601919aedc6cadca673109684aa499326.tar.xz
dma-buf: heaps: Clear CMA pages with clear_pages()
As of commit 62a9f5a85b98 "mm: introduce clear_pages() and clear_user_pages()" we can clear a range of pages with a potentially assembly-optimized call. Instead of using a memset, use this helper to clear the whole range of pages from the CMA allocation. Reviewed-by: T.J. Mercier <tjmercier@google.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260310-cma-heap-clear-pages-v2-1-ecbbed3d7e6d@kernel.org
-rw-r--r--drivers/dma-buf/heaps/cma_heap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c
index bd3370b9a3f6..f0bacf25ed9d 100644
--- a/drivers/dma-buf/heaps/cma_heap.c
+++ b/drivers/dma-buf/heaps/cma_heap.c
@@ -343,7 +343,7 @@ static struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
nr_clear_pages--;
}
} else {
- memset(page_address(cma_pages), 0, size);
+ clear_pages(page_address(cma_pages), pagecount);
}
buffer->pages = kmalloc_objs(*buffer->pages, pagecount);