From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: Tianyou Li <tianyou.li@intel.com>,
Oscar Salvador <osalvador@suse.de>,
Mike Rapoport <rppt@kernel.org>,
Wei Yang <richard.weiyang@gmail.com>
Cc: 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 v7 1/2] mm/memory hotplug: fix zone->contiguous always false when hotplug
Date: Tue, 6 Jan 2026 21:03:56 +0100 [thread overview]
Message-ID: <857be078-1464-4e29-979d-0459cad8508b@kernel.org> (raw)
In-Reply-To: <20251222145807.11351-2-tianyou.li@intel.com>
On 12/22/25 15:58, Tianyou Li wrote:
> Function set_zone_contiguous used __pageblock_pfn_to_page to
> check the whole pageblock is in the same zone. One assumption is
> the memory section must online, otherwise the __pageblock_pfn_to_page
> will return NULL, then the set_zone_contiguous will be false.
> When move_pfn_range_to_zone invoked set_zone_contiguous, since the
> memory section did not online, the return value will always be false.
>
> To fix this issue, we removed the set_zone_contiguous from the
> move_pfn_range_to_zone, and place it after memory section onlined.
>
> Function remove_pfn_range_from_zone did not have this issue because
> memory section remains online at the time set_zone_contiguous invoked.
The description is a bit hard to follow. Let me try:
"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"
Now, there is no need to add the handling to
mhp_init_memmap_on_memory(). Note how mhp_init_memmap_on_memory() in
memory_block_online() is always followed by online_pages().
So, it's sufficient to move it after the online_pages_range(). I would
also add a comment there saying something like:
/*
* Now that the ranges are indicated as online, check whether the whole
* zone is contiguous.
*/
Can we find some Fixes: tag (which commit introduced the regression)?
Likely we want to CC stable.
--
Cheers
David
next prev parent reply other threads:[~2026-01-06 20:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 14:58 [PATCH v7 0/2] Optimize zone->contiguous update and issue fix Tianyou Li
2025-12-22 14:58 ` [PATCH v7 1/2] mm/memory hotplug: fix zone->contiguous always false when hotplug Tianyou Li
2026-01-06 20:03 ` David Hildenbrand (Red Hat) [this message]
2025-12-22 14:58 ` [PATCH v7 2/2] mm/memory hotplug/unplug: Optimize zone->contiguous update when changes pfn range Tianyou Li
2026-01-06 20:18 ` David Hildenbrand (Red Hat)
2026-01-06 20:25 ` David Hildenbrand (Red Hat)
2026-01-05 12:21 ` [PATCH v7 0/2] Optimize zone->contiguous update and issue fix Li, Tianyou
2026-01-05 16:27 ` David Hildenbrand (Red Hat)
2026-01-06 3:48 ` 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=857be078-1464-4e29-979d-0459cad8508b@kernel.org \
--to=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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=rppt@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox