Re: [PATCH v5 1/5] mm: move mirrored memory overlap checking to the outer loop
From: David Hildenbrand (Arm)
Date: Thu Jul 02 2026 - 09:22:46 EST
On 6/26/26 10:26, Liu, Yuan1 wrote:
>
>> -----Original Message-----
>> From: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>> Sent: Thursday, June 25, 2026 8:05 PM
>> To: Liu, Yuan1 <yuan1.liu@xxxxxxxxx>; Oscar Salvador <osalvador@xxxxxxx>;
>> Mike Rapoport <rppt@xxxxxxxxxx>; Wei Yang <richard.weiyang@xxxxxxxxx>
>> Cc: linux-mm@xxxxxxxxx; Hu, Yong <yong.hu@xxxxxxxxx>; Zou, Nanhai
>> <nanhai.zou@xxxxxxxxx>; Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>; Zhuo, Qiuxu
>> <qiuxu.zhuo@xxxxxxxxx>; Chen, Yu C <yu.c.chen@xxxxxxxxx>; Deng, Pan
>> <pan.deng@xxxxxxxxx>; Li, Tianyou <tianyou.li@xxxxxxxxx>; Chen Zhang
>> <zhangchen.kidd@xxxxxx>; Zeng, Jason <jason.zeng@xxxxxxxxx>; linux-
>> kernel@xxxxxxxxxxxxxxx
>> Subject: Re: [PATCH v5 1/5] mm: move mirrored memory overlap checking to
>> the outer loop
>>
>> On 5/20/26 11:34, Yuan Liu wrote:
>>> Move the overlap memmap initialization check from memmap_init_range()
>>> to memmap_init(), and replace the per-PFN check with a memblock-based
>>> check.
>>>
>>> Reviewed-by: Wei Yang <richard.weiyang@xxxxxxxxx>
>>> Reviewed-by: Jason Zeng <jason.zeng@xxxxxxxxx>
>>> Signed-off-by: Yuan Liu <yuan1.liu@xxxxxxxxx>
>>> ---
>>
>> IIRC, with the patch from Mike+Wei this patch here should no longer be
>> required,
>> right?
>>
>> https://lore.kernel.org/r/20260625073941.145014-1-rppt@xxxxxxxxxx
>
> Hi David
>
> Yes, we don't need the overlap-related patch anymore. The zone contiguity optimization will build on top of Mike's and Wei's changes, and I'll update the patches accordingly.
>
> These days I've been revisiting the issue where pages_with_online_memmap overcounts subsection hole pages in early sections.
>
> We previously attempted to address this with a patch [1], but I think the concern raised by Sashiko [2] is valid, so we may not be able to use patch [1].
>
> I can think of the following alternative approach, which can avoid changing semantics of pfn_valid() or first_valid_pfn():
>
> Basically we calculate pages_with_online_memmap by iterating over subsections in each zone during memmap_init(), to see pfn_to_online_page(start_pfn) is true or not.
> If it is true, then the whole subsection will be counted into pages_with_online_memmap.
We really should strive for a solution that doesn't walk any PFN ranges to
perform a pfn_to_online_page().
--
Cheers,
David