Re: [PATCH v8 2/7] mm: introduce clear_pages() and clear_user_pages()
From: Ankur Arora
Date: Tue Nov 18 2025 - 14:24:45 EST
David Hildenbrand (Red Hat) <david@xxxxxxxxxx> writes:
> 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@xxxxxxxxxx>
>> ---
>> 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.
Sounds good. For this one and the other.
> (sorry for the back-and-forth, it's rather unclear what the best practice is)
No worries.
--
ankur