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=1796383090; b=NOrIBoXDZu9Wu5DvZXpsezrf5tdjk/OjoxgdKoLkauvEFSw2zUL37jVcfp5EAFpjprCn UfdIYISwcj0Hg5LgNkzacJnrXsI3lR4rnr0i3wEajwd3tYKWSMIP2zcnfs4pzbFklewo+ s3UdWPO0PnUWC3QseoRuKINSWejOTDw26uqvrKxY4dsSR9UcK+9y8xO5wvbBwOrTg0ZCV E6AviZcb+mdKYRrx+kiAT0bq9k3W4Ldaz7yZ273RgyG6ty8s7c5Q8V4IqyIzYLP02f9f7 92tpzjoMeu1k1kmDncpHK0OE5RvwLbZqHmcguUdOCBQCuYBl/OSFKGjRBnbpT8NLzhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383090; 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=pGGmRZ0mYUK0Fp78iX2/0S8QIw0SBI1kZ/zfWQpkIfY=; b=s1CRNuqoGupNKP3f9ZCE6h2inH+/xKIHE68YdTOszJL9zwrc05W+UyBG/RHQic4zp/Fn U0DGmRlQ/JpdYkMHaW/mxSU0f6p1ZGTFr7CRKi1MdtNWXAGQgpyfzV9SAbqYyKZhl/PCG ujCYDMY6JB0DKMlJXHgmmsDejylwW+66eYyd7O3c7+o/48a2MxhTxiYhRqupHj4jb+sn+ pJw2ek+ZaW6SeBQSuh9pPXaH8G1zQH2BLEizxepUdv85kgVIQ7glcerdVCL2+1mAJN6yA EBSpEUAzbqruTy4Avr3DN2ElqNX2cN06fA1l8K/9el98WwYNas0YqzKLFqGgKs9RQqg== 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=PZG6eZ0A; 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 119A9606A334; Fri, 4 Dec 2026 11:18:09 +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=PZG6eZ0A Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B5B91F00931; Fri, 4 Dec 2026 11:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383089; bh=pGGmRZ0mYUK0Fp78iX2/0S8QIw0SBI1kZ/zfWQpkIfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PZG6eZ0ABhulmBs+R/ZdULDvZqvA50TLSsIdZeFAcjz4lBsM2YkRPZ8W6XYTS4ZSa UkqU7saMHZ6F6ei1KgiCQoXrwpK2CQUGFrBWUVNV8Foe/ktbXozygLvGCHolr662Ty 0N4ixH1DceCXag/RQbSvzlDxCe304EOxlYql6dGQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Josef Bacik , "Vlastimil Babka (SUSE)" , Sasha Levin Subject: [PATCH 6.12 083/555] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx() Date: Fri, 4 Dec 2026 19:02:06 +0900 Message-ID: <20261204100610.332777565@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vlastimil Babka (SUSE) [ Upstream commit 2122887b04f3f2d76daa80055c2c273926032fa0 ] Whenever the flags of a pageblock are read or written, a kernel with CONFIG_DEBUG_VM makes sure that the pfn lies within the zone of the page. Unlike bad_range(), that check reads zone->zone_start_pfn and zone->spanned_pages without zone->span_seqlock. Memory hotplug changes the two fields one after the other. If the lower end of a zone moves, the zone seems to end before its last pages in between. A page of that part which is freed at that moment, on another CPU, ends in page dumped because: VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn)) kernel BUG at mm/page_alloc.c:372! free_unref_folios+0x55e/0xed0 folios_put_refs+0x2b5/0x530 An attempt has been made [1] to fix this with the span seqlock check. But that can trigger all sorts of problems in restricted contexts, as noted by sashiko [2]. Since this is just a sanity debug check and anything with BUG_ON is frowned upon anyway, just remove it altogether. Reported-by: Josef Bacik Closes: https://lore.kernel.org/all/20261027-pgalloc-ai-hotfixes-v1-9-9c7d1aca801e@kernel.org/ [1] Link: https://lore.kernel.org/all/sashiko-outbox-188081@kernel.org/ [2] Fixes: 86051ca5eaf5 ("mm: fix usemap initialization") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-5-e0d2890ab74f@kernel.org Signed-off-by: Vlastimil Babka (SUSE) [ sashal: Retargeted the zone-span assertion removal from get_pfnblock_bitmap_bitidx() to set_pfnblock_flags_mask(). ] Signed-off-by: Sasha Levin --- mm/page_alloc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9615e2b3def5b..f3383313d6d80 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -435,8 +435,6 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags, word_bitidx = bitidx / BITS_PER_LONG; bitidx &= (BITS_PER_LONG-1); - VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page); - mask <<= bitidx; flags <<= bitidx; -- 2.53.0