On 3/10/26 09:53, Linus Walleij wrote:
> Currently the CMA allocator clears highmem pages using
> kmap()->clear_page()->kunmap(), but there is a helper
> static inline in <linux/highmem.h> that does the same for
> us so use clear_highpage() instead of open coding this.
> 
> Suggested-by: T.J. Mercier <[email protected]>
> Signed-off-by: Linus Walleij <[email protected]>

Ah yes, somebody pointed that out to me before but I never found time to write 
a patch to clean it up.

Reviewed-by: Christian König <[email protected]>

> ---
>  drivers/dma-buf/heaps/cma_heap.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/dma-buf/heaps/cma_heap.c 
> b/drivers/dma-buf/heaps/cma_heap.c
> index f0bacf25ed9d..92865786cfc9 100644
> --- a/drivers/dma-buf/heaps/cma_heap.c
> +++ b/drivers/dma-buf/heaps/cma_heap.c
> @@ -329,10 +329,7 @@ static struct dma_buf *cma_heap_allocate(struct dma_heap 
> *heap,
>                 struct page *page = cma_pages;
> 
>                 while (nr_clear_pages > 0) {
> -                       void *vaddr = kmap_local_page(page);
> -
> -                       clear_page(vaddr);
> -                       kunmap_local(vaddr);
> +                       clear_highpage(page);
>                         /*
>                          * Avoid wasting time zeroing memory if the process
>                          * has been killed by SIGKILL.
> 
> --
> 2.53.0
> 

Reply via email to