Re: [PATCH] mm/memory hotplug/unplug: Optimize zone contiguous check when changing pfn range
From: Andrew Morton
Date: Thu Mar 19 2026 - 23:13:10 EST
On Thu, 19 Mar 2026 05:56:22 -0400 Yuan Liu <yuan1.liu@xxxxxxxxx> wrote:
> When invoke move_pfn_range_to_zone or remove_pfn_range_from_zone, it will
> update the zone->contiguous by checking the new zone's pfn range from the
> beginning to the end, regardless the previous state of the old zone. When
> the zone's pfn range is large, the cost of traversing the pfn range to
> update the zone->contiguous could be significant.
>
> Add a new zone's pages_with_memmap member, it is pages within the zone that
> have an online memmap. It includes present pages and memory holes that have
> a memmap. When spanned_pages == pages_with_online_memmap, pfn_to_page() can
> be performed without further checks on any pfn within the zone span.
AI review asks questions:
https://sashiko.dev/#/patchset/20260319095622.1130380-1-yuan1.liu%40intel.com