On Sun, Nov 30, 2025 at 2:54 AM Linus Walleij <[email protected]> wrote:
>
> 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: Linus Walleij <[email protected]>

Reviewed-by: T.J. Mercier <[email protected]>

> ---
>  drivers/dma-buf/heaps/cma_heap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/heaps/cma_heap.c 
> b/drivers/dma-buf/heaps/cma_heap.c
> index 0df007111975..9eaff80050f2 100644
> --- a/drivers/dma-buf/heaps/cma_heap.c
> +++ b/drivers/dma-buf/heaps/cma_heap.c
> @@ -315,7 +315,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
>
> ---
> base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> change-id: 20251129-dma-buf-heap-clear-page-248bb236e4c4
>
> Best regards,
> --
> Linus Walleij <[email protected]>
>

Reply via email to