lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251222145807.11351-2-tianyou.li@intel.com>
Date: Mon, 22 Dec 2025 22:58:06 +0800
From: Tianyou Li <tianyou.li@...el.com>
To: David Hildenbrand <david@...hat.com>,
	Oscar Salvador <osalvador@...e.de>,
	Mike Rapoport <rppt@...nel.org>,
	Wei Yang <richard.weiyang@...il.com>
Cc: linux-mm@...ck.org,
	Yong Hu <yong.hu@...el.com>,
	Nanhai Zou <nanhai.zou@...el.com>,
	Yuan Liu <yuan1.liu@...el.com>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
	Yu C Chen <yu.c.chen@...el.com>,
	Pan Deng <pan.deng@...el.com>,
	Tianyou Li <tianyou.li@...el.com>,
	Chen Zhang <zhangchen.kidd@...com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH v7 1/2] mm/memory hotplug: fix zone->contiguous always false when hotplug

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.

Reviewed-by: Nanhai Zou <nanhai.zou@...el.com>
Signed-off-by: Yuan Liu <yuan1.liu@...el.com>
Signed-off-by: Tianyou Li <tianyou.li@...el.com>
---
 mm/memory_hotplug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a63ec679d861..ce6caf8674a5 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);
 }
 
 struct auto_movable_stats {
@@ -1115,6 +1113,7 @@ int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages,
 	if (nr_pages >= PAGES_PER_SECTION)
 	        online_mem_sections(pfn, ALIGN_DOWN(end_pfn, PAGES_PER_SECTION));
 
+	set_zone_contiguous(zone);
 	return ret;
 }
 
@@ -1205,6 +1204,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages,
 	}
 
 	online_pages_range(pfn, nr_pages);
+	set_zone_contiguous(zone);
 	adjust_present_page_count(pfn_to_page(pfn), group, nr_pages);
 
 	if (node_arg.nid >= 0)
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ