Re: [PATCH v9 2/2] mm/memory hotplug/unplug: Optimize zone->contiguous update when changes pfn range
From: Mike Rapoport
Date: Thu Feb 12 2026 - 03:35:05 EST
On Wed, Feb 11, 2026 at 01:19:56PM +0100, David Hildenbrand (Arm) wrote:
> > > *
> > > + * online_pages is pages within the zone that have an online memmap.
> > > + * online_pages include present pages and memory holes that have a
> > > + * memmap. When spanned_pages == online_pages, pfn_to_page() can be
> > > + * performed without further checks on any pfn within the zone span.
> >
> > Maybe pages_with_memmap? It would stand off from managed, spanned and
> > present, but it's clearer than online IMHO.
>
> offline pages also have a memmap, but that should not be touched as it might
> contain garbage. So it's a bit more tricky :)
Naming is hard :)
But I still think mentioning memmap there is useful :)
> Looking at set_zone_contiguous(), __pageblock_pfn_to_page() takes care of a
> weird case where the end of a zone falls into the middle of a pageblock.
>
> I am not even sure if that is possible
It's possible if a pageblock crosses node boundary. We also might add
VM_BUG_ON(pageblock_crosses_nodes(), "FIX YOUR FIRMWARE!") there ;-)
> but we could handle that easily in pageblock_pfn_to_page() by checking
> the requested range against the zone spanned range.
Agree.
> Then the semantics "zone->online_pages" would be less weird and more closely
> resemble "pages with online memmap".
>
> init_unavailable_range() might indeed do the trick!
>
> @Tianyou, can you explore that direction? I know, your PTO is coming up.
>
> --
> Cheers,
>
> David
--
Sincerely yours,
Mike.