Re: [PATCH v9 2/2] mm/memory_hotplug: optimize zone contiguous check when changing pfn range
From: David Hildenbrand (Arm)
Date: Fri Sep 18 2026 - 08:21:49 EST
On 9/18/26 04:08, Liu, Yuan1 wrote:
>> -----Original Message-----
>> From: Mike Rapoport <rppt@xxxxxxxxxx>
>> Sent: Wednesday, September 16, 2026 2:58 AM
>> To: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>> Cc: Liu, Yuan1 <yuan1.liu@xxxxxxxxx>; Oscar Salvador <osalvador@xxxxxxx>;
>> Wei Yang <richard.weiyang@xxxxxxxxx>; linux-mm@xxxxxxxxx; Zou, Nanhai
>> <nanhai.zou@xxxxxxxxx>; Chen Zhang <zhangchen.kidd@xxxxxx>; Zeng, Jason
>> <jason.zeng@xxxxxxxxx>; Chen, Yu C <yu.c.chen@xxxxxxxxx>; Deng, Pan
>> <pan.deng@xxxxxxxxx>; Li, Tianyou <tianyou.li@xxxxxxxxx>; linux-
>> kernel@xxxxxxxxxxxxxxx
>> Subject: Re: [PATCH v9 2/2] mm/memory_hotplug: optimize zone contiguous
>> check when changing pfn range
>>
>> On Tue, Sep 15, 2026 at 05:20:07PM +0200, David Hildenbrand (Arm) wrote:
>> a
>> pageblock
>> cost
>> pfn, int nid)
>> last
>> spfn,
>> section
>> However, only
>> online.
>>>
>>>
>>> Maybe extending that a bit we could do
>>>
>>> "With CONFIG_SPARSEMEM_VMEMMAP, early sections have a valid memmap for
>> all PFNs
>>> and the sections are marked online. However, we might have offline
>> subsections
>>> in such early sections, indicated by the subsection map. While we must
>>> initialize the entire valid memmap, account only the online pages
>> according to
>>> the subsection map as online (see pfn_to_online_page())."
>>
>> init_unavailable_range() already has large comment on top, adding
>> something
>> like that there makes perfect sense to me :)
>>
>> How about a bit different version:
>>
>> * The function counts pages that should be added to
>> * zone->pages_with_online_memmap.
>> * With CONFIG_SPARSEMEM_VMEMMAP there could be offline subsections even
>> though
>> * the entire memory map is valid and all the early sections are online.
>> * Count only pages in online subsections (see pfn_to_online_page()).
>
> Hi David
>
> Should I prepare and send a new version based on Mike's latest suggested changes?
Yes please. I guess this comment is the final bit before this should be good to go.
--
Cheers,
David