Re: [PATCH v8 2/7] mm: introduce clear_pages() and clear_user_pages()

David Hildenbrand (Red Hat)
2025-11-18T07:34:24Z

On 27.10.25 21:21, Ankur Arora wrote:
> Introduce clear_pages(), to be overridden by architectures that
> support more efficient clearing of consecutive pages.
>
> Also introduce clear_user_pages(), however, we will not expect
> this function to be overridden anytime soon.
>
> We have to place the clear_user_pages() variant that uses
> clear_user_page() into mm/util.c for now to work around
> macro magic on sparc and m68k.
>
> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
> ---
> include/linux/mm.h | 41 +++++++++++++++++++++++++++++++++++++++++
> mm/util.c | 13 +++++++++++++
> 2 files changed, 54 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 683168b522b3..ecbcb76df9de 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3872,6 +3872,26 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,
> unsigned int order) {}
> #endif /* CONFIG_DEBUG_PAGEALLOC */
>
> +#ifndef __HAVE_ARCH_CLEAR_PAGES

Also here, let's base it on

#ifndef clear_pages

and similarly below for clear_user_pages.

(sorry for the back-and-forth, it's rather unclear what the best
practice is)

--
Cheers

David