Re: [RFC PATCH] mm: avoid clearing user movable page twice with init_on_alloc=1
From: Huang, Ying
Date: Fri Oct 11 2024 - 03:01:16 EST
Zi Yan <ziy@xxxxxxxxxx> writes:
[snip]
> diff --git a/include/linux/highmem.h b/include/linux/highmem.h
> index 930a591b9b61..4b15224842e1 100644
> --- a/include/linux/highmem.h
> +++ b/include/linux/highmem.h
> @@ -220,18 +220,8 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
> * Return: A folio containing one allocated and zeroed page or NULL if
> * we are out of memory.
> */
> -static inline
> -struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma,
> - unsigned long vaddr)
> -{
> - struct folio *folio;
> -
> - folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, vaddr, false);
> - if (folio)
> - clear_user_highpage(&folio->page, vaddr);
> -
> - return folio;
> -}
> +#define vma_alloc_zeroed_movable_folio(vma, vaddr) \
> + vma_alloc_folio(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, 0, vma, vaddr, false)
Although just one line, I still prefer to use inline function instead of
macro here. Not strong opinion.
> #endif
[snip]
--
Best Regards,
Huang, Ying