Re: [PATCH v2] mm/page_alloc: use batch page clearing in kernel_init_pages()

From: Salunke, Hrushikesh

Date: Wed Apr 22 2026 - 00:58:16 EST



On 21-04-2026 19:36, David Hildenbrand (Arm) wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On 4/21/26 16:03, Zi Yan wrote:
>> On 21 Apr 2026, at 9:57, David Hildenbrand (Arm) wrote:
>>
>>> On 4/21/26 15:44, Zi Yan wrote:
>>>>
>>>> kasan_reset_tag() here removes the tag from page address, so that
>>>> clear_pages() can use the right kaddr. I thought each page needs
>>>> a kasan_reset_tag(). No need to respond here, as I am reading
>>>> the code and trying to understand how it works.
>>> It's all confusing. But we really just turn the pointer into an untagged
>>> pointer here, once.
>> Yes, I realized that after reading kasan_reset_tag() implementation.
>>
>>> So I think this is ok.
>>>
>>> I do wonder, though, whether we want to move the
>>> kasan_disable_current/kasan_enable_current into the
>>> clear_highpages_kasan_tagged().
>> This sounds reasonable to me. And also replace kernel_init_pages()
>> with clear_highpages_kasan_tagged(), since kernel_init_pages()
>> will be a wrapper then.
> Agreed.

Thanks David and Zi Yan for the review.

That makes sense, moving KSAN handling into the helper function makes
it self-contained and cleaner. kernel_init_pages only has two call
sites in page_alloc.c, so replacing it with direct calls to the helper
should be straightforward.

I will incorporate these changes in v3.

Regards,
Hrushikesh.