From nobody Sun Feb 8 21:47:07 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F0892E8DEA for ; Mon, 22 Dec 2025 13:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766411992; cv=none; b=Fa2/9YbQJrIHknslujED4mSrDCBtE9wMyiUQMUKlCGN8P9T3RRbhZGG8UCuHWeiG4qMBQdoVgVfhBk4gkOQQl9xr1CSZoNPW6YHKMHkaCaF8o2EWokAdJKRizkx93ZgdDUDC6AIcDUyOBCHOj/SBRVQoTFZ47vlfQBioQXUBYJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766411992; c=relaxed/simple; bh=8ZfPW8FLfn5108gLlzBjYP1a7U55zV4LZPgYpJMp4sM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PSW+Y7vSXuJKBU6aiJi3+VoY4Uom2vYG+pZ/JDL1723rVrhRClf9KDOtC7oxXRZn2VdOfswi/EijWjy7U2Zj162c9Hvt9HNTPnAq9yy1rsr0qKsMFxLsGmk1eC7pa4/jhRZvsGgMb85xhgr0vIZvpQY+TfHhMw7efUxd6dgotfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ywawk+8/; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ywawk+8/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1766411991; x=1797947991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8ZfPW8FLfn5108gLlzBjYP1a7U55zV4LZPgYpJMp4sM=; b=Ywawk+8/TBzEn8rVS+395BlqHVBMg06md8VxYwXQBN3xkrB6bwN+M3nr P6JuAYXJzsSNZD0QEhviYQQ6DQqYUdsaYAVmQURYCiW/WlhSqzs/lysUz fdVAjeO8QueG+OeVm1PxdAyoapZLS702Mk+gkWuLevUWnLJ51/lz3+adg pH/MlQygowF9W3dOGCdshzohCfCOBg+klDE7uJ2lLqqUhYvAjE16Dl3e3 92YsRbgdtrU0gVbIopNTg0SjrPCMQCwseIvXLjtlUwWuM3apdhYr9Af9T 0L+dyQlAfcoKf4gQB5QHFXXCdEOfE5A5GSKI2KTxkHS3GW3ZsPvNPXcec w==; X-CSE-ConnectionGUID: ydyK6hAMRBC9MdpLbZVAdg== X-CSE-MsgGUID: uy/8UsHFQU2//J6qCmxVig== X-IronPort-AV: E=McAfee;i="6800,10657,11650"; a="68248524" X-IronPort-AV: E=Sophos;i="6.21,168,1763452800"; d="scan'208";a="68248524" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2025 05:59:51 -0800 X-CSE-ConnectionGUID: +3QTUcGgRp6cLKlkaopwTg== X-CSE-MsgGUID: 6+XTCocSTvKH5wkIhm219A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,168,1763452800"; d="scan'208";a="230189558" Received: from linux-pnp-server-27.sh.intel.com ([10.239.147.41]) by orviesa002.jf.intel.com with ESMTP; 22 Dec 2025 05:59:46 -0800 From: Tianyou Li To: David Hildenbrand , Oscar Salvador , Mike Rapoport , Wei Yang Cc: linux-mm@kvack.org, Yong Hu , Nanhai Zou , Yuan Liu , Tim Chen , Qiuxu Zhuo , Yu C Chen , Pan Deng , Tianyou Li , Chen Zhang , linux-kernel@vger.kernel.org Subject: [PATCH v7 1/2] mm/memory hotplug: fix zone->contiguous always false when hotplug Date: Mon, 22 Dec 2025 22:58:06 +0800 Message-ID: <20251222145807.11351-2-tianyou.li@intel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20251222145807.11351-1-tianyou.li@intel.com> References: <20251222145807.11351-1-tianyou.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Yuan Liu Signed-off-by: Tianyou Li --- 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); } =20 struct auto_movable_stats { @@ -1115,6 +1113,7 @@ int mhp_init_memmap_on_memory(unsigned long pfn, unsi= gned long nr_pages, if (nr_pages >=3D PAGES_PER_SECTION) online_mem_sections(pfn, ALIGN_DOWN(end_pfn, PAGES_PER_SECTION)); =20 + set_zone_contiguous(zone); return ret; } =20 @@ -1205,6 +1204,7 @@ int online_pages(unsigned long pfn, unsigned long nr_= pages, } =20 online_pages_range(pfn, nr_pages); + set_zone_contiguous(zone); adjust_present_page_count(pfn_to_page(pfn), group, nr_pages); =20 if (node_arg.nid >=3D 0) --=20 2.47.1