From: Mike Rapoport <rppt@kernel.org>
To: Tianyou Li <tianyou.li@intel.com>
Cc: David Hildenbrand <david@kernel.org>,
Oscar Salvador <osalvador@suse.de>,
Wei Yang <richard.weiyang@gmail.com>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, Yong Hu <yong.hu@intel.com>,
Nanhai Zou <nanhai.zou@intel.com>, Yuan Liu <yuan1.liu@intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Qiuxu Zhuo <qiuxu.zhuo@intel.com>,
Yu C Chen <yu.c.chen@intel.com>, Pan Deng <pan.deng@intel.com>,
Chen Zhang <zhangchen.kidd@jd.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 1/3] mm/memory hotplug: Fix zone->contiguous always false when hotplug
Date: Thu, 22 Jan 2026 13:16:43 +0200 [thread overview]
Message-ID: <aXIHG8MQhMRt7M5d@kernel.org> (raw)
In-Reply-To: <20260120143346.1427837-2-tianyou.li@intel.com>
Hi,
On Tue, Jan 20, 2026 at 10:33:44PM +0800, Tianyou Li wrote:
> From: Yuan Liu <yuan1.liu@intel.com>
>
> set_zone_contiguous() uses __pageblock_pfn_to_page() to detect
> pageblocks that either do not exist (hole) or that do not belong
> to the same zone.
>
> __pageblock_pfn_to_page(), however, relies on pfn_to_online_page(),
> effectively always returning NULL for memory ranges that were not
> onlined yet. So when called on a range-to-be-onlined, it indicates
> a memory hole to set_zone_contiguous().
>
> Consequently, the set_zone_contiguous() call in move_pfn_range_to_zone(),
> which happens early during memory onlining, will never detect a
> zone as being contiguous. Bad.
>
> To fix the issue, move the set_zone_contiguous() call to a later
> stage in memory onlining, where pfn_to_online_page() will succeed:
> after we mark the memory sections to be online.
>
> Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")
cc stable@ perhaps?
> Cc: Michal Hocko <mhocko@suse.com>
> Reviewed-by: Nanhai Zou <nanhai.zou@intel.com>
> Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
> Signed-off-by: Tianyou Li <tianyou.li@intel.com>
> ---
> mm/memory_hotplug.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index a63ec679d861..c8f492b5daf0 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -782,8 +782,6 @@ void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
> memmap_init_range(nr_pages, nid, zone_idx(zone), start_pfn, 0,
> MEMINIT_HOTPLUG, altmap, migratetype,
> isolate_pageblock);
> -
> - set_zone_contiguous(zone);
move_pfn_range_to_zone() is also called from memremap::pagemap_range().
Shouldn't we add set_zone_contiguous() there as well?
> }
>
> struct auto_movable_stats {
> @@ -1205,6 +1203,13 @@ int online_pages(unsigned long pfn, unsigned long nr_pages,
> }
>
> online_pages_range(pfn, nr_pages);
> +
> + /*
> + * Now that the ranges are indicated as online, check whether the whole
> + * zone is contiguous.
> + */
> + set_zone_contiguous(zone);
> +
> adjust_present_page_count(pfn_to_page(pfn), group, nr_pages);
>
> if (node_arg.nid >= 0)
> --
> 2.47.1
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-01-22 11:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 14:33 [PATCH v8 0/3] Optimize zone->contiguous update and issue fix Tianyou Li
2026-01-20 14:33 ` [PATCH v8 1/3] mm/memory hotplug: Fix zone->contiguous always false when hotplug Tianyou Li
2026-01-22 11:16 ` Mike Rapoport [this message]
2026-01-24 12:18 ` Li, Tianyou
2026-01-26 21:58 ` Andrew Morton
2026-01-28 14:16 ` Li, Tianyou
2026-01-27 6:53 ` Mike Rapoport
2026-01-28 13:49 ` Li, Tianyou
2026-01-20 14:33 ` [PATCH v8 2/3] mm/memory hotplug/unplug: Add online_memory_block_pages() and offline_memory_block_pages() Tianyou Li
2026-01-22 11:32 ` Mike Rapoport
2026-01-24 12:30 ` Li, Tianyou
2026-01-27 6:58 ` Mike Rapoport
2026-01-28 13:56 ` Li, Tianyou
2026-01-20 14:33 ` [PATCH v8 3/3] mm/memory hotplug/unplug: Optimize zone->contiguous update when changes pfn range Tianyou Li
2026-01-22 11:43 ` Mike Rapoport
2026-01-24 12:43 ` Li, Tianyou
2026-01-27 7:10 ` Mike Rapoport
2026-01-28 14:11 ` Li, Tianyou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aXIHG8MQhMRt7M5d@kernel.org \
--to=rppt@kernel.org \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=nanhai.zou@intel.com \
--cc=osalvador@suse.de \
--cc=pan.deng@intel.com \
--cc=qiuxu.zhuo@intel.com \
--cc=richard.weiyang@gmail.com \
--cc=tianyou.li@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=yong.hu@intel.com \
--cc=yu.c.chen@intel.com \
--cc=yuan1.liu@intel.com \
--cc=zhangchen.kidd@jd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.