From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388101; b=JSoEeoPUKvm77wpRwEqprDzAsHOWHWktnOJu6gB8srFoC3imjW5KT30pL8TQRvEK4VeM GLgiAOJAPdPxNxZkTnx4VBBQ4BiBJKXsnBgj95b41BtQnOafGfdFud/v6yCs9+hi5Z6g9 KiSsvODS2YNimbvoKgc4InVZaUoZ9kC+04mRBJyuEEjpEIo6qwMVZeY/x/29XxdqbIl7e JdcmyR8Y7VsgaC6SjYxdjKa0RiyXZH5HWahU+G0BoHU3DnlMN2Ouce9v6W1SJ64xu9eRg e28D0V7qX2OfIoasnMScEk2Z7hRXOisscq0s3lYza4XeG9siAuSsiTKRTUxED+4pdkg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388101; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=r3hyT99DHbO98Qu/MtT5efasvFeFPMTFlf+GXcj3ToE=; b=RmAWBPeMA0HpGoxIgfE1m3pl2i+TwSahmLavt5KLcs5mk4Txs1vjClY9kFUqAIU4wHWV yGSsdZVPjtTSP5RXtS6XzLwBke1lN2sncwEoEES/bCW3zzCM2EV0lDPyD58ah2Xd6b0/X yianFNTqctbu7CaKxNndfj/fmYbhtFbykQFbXnwFuGuXDLy6qYa/IsO01ZPSq54SccplZ IHAOfjIMIGmFC3NbQtlRibKRDQbeQrnTapdfW1EToCrh1EiHPa1Jzv4UT0mebndrOhbzw uqBmORAdIXlgtFq6/crZmBv9QWmzMpA75D9ktH6G+wS1q4Tsxq4rgKwL3iXa+qTMr1w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dZk+wVlK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2683606A322; Fri, 4 Dec 2026 12:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dZk+wVlK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 293FF1F000C2; Fri, 4 Dec 2026 12:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388101; bh=r3hyT99DHbO98Qu/MtT5efasvFeFPMTFlf+GXcj3ToE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dZk+wVlKBnjzrgwy8ek1hLKpWIaAP8Ep2q7GKEzHtu/57d7tAVEqeV/zXMxqR9xVr SThykZQf9sc552mZWmclsrWivfRMiFoIjnS9mFY8XtnN0IUTrEkN5wJfFOaaInRqkK XOngny8J/4sm8BXeyiH88j5ZNUxgydcyHfgPqcok= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Vlastimil Babka (SUSE)" , "Gregory Price (Meta)" , Zi Yan Subject: [PATCH 6.1 0483/1059] mm/page_alloc: detect zonelist rebuilds from memory hot-add Date: Fri, 4 Dec 2026 19:00:14 +0900 Message-ID: <20261204100656.753972761@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gregory Price (Meta) commit e5db040c3d09c5d85dda70f736d4d1a6714b741e upstream. The zonelist_update_seq retry was limited to CONFIG_MEMORY_HOTREMOVE, presumably because only hot-remove takes zones out of a zonelist. However, build_zonerefs_node() rewrites the zonelists in place, so onlining the first block of a zone shifts the entries that follow it in every zonelist containing that zone. This can cause a spurious allocation failure for a __GFP_THISNODE caller. For a node with only ZONE_NORMAL, onlining its first ZONE_MOVABLE block rewrites the node's ZONELIST_NOFALLBACK list as: [NORMAL, NULL] -> [MOVABLE, NULL] -> [MOVABLE, NORMAL, NULL] A concurrent GFP_KERNEL | __GFP_THISNODE allocation can observe the intermediate list, skip ZONE_MOVABLE, and find no eligible zone. With CONFIG_MEMORY_HOTREMOVE=n, check_retry_zonelist() returns 0 and the allocation fails even though the node has free ZONE_NORMAL memory. Gate the sequence checks on CONFIG_MEMORY_HOTPLUG, which covers every configuration that rebuilds zonelists after boot. Fixes: 3d36424b3b58 ("mm/page_alloc: fix race condition between build_all_zonelists and page allocation") Cc: stable@vger.kernel.org Reviewed-by: Vlastimil Babka (SUSE) Signed-off-by: Gregory Price (Meta) Link: https://patch.msgid.link/20261101021340.2251928-5-gourry@gourry.net Acked-by: Zi Yan Signed-off-by: Vlastimil Babka (SUSE) Signed-off-by: Greg Kroah-Hartman --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4803,7 +4803,7 @@ static DEFINE_SEQLOCK(zonelist_update_se static unsigned int zonelist_iter_begin(void) { - if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) return read_seqbegin(&zonelist_update_seq); return 0; @@ -4811,7 +4811,7 @@ static unsigned int zonelist_iter_begin( static unsigned int check_retry_zonelist(unsigned int seq) { - if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) return read_seqretry(&zonelist_update_seq, seq); return seq;