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=1796386007; b=mefgALdivA8kimfI8e2EZTrpBto6oqaXQTMVS63PLAqgH9S1Fbnyj6YRDVo9s1eyHVl+ Wu08sDjZJUQaM9egxtuyNCkG+RRPOcCk2uISlLx90WA4bwFd/RE0sKyQibHFhXwD5SSH/ rimGMNITiIPlhHmTjzCe6IXLwu4GHqA5he/LnkOhbuv+c7lZ+BFSmCvbekyOrOD23uB9W PHFi3fepJ3mRoTDIEhIsqubmEV3/lgEL6hxuSnvkSE9wozTuibc18RhAT4yfwVY3axtFl 0jk03lxMLU3A1iZUTv2k36bqVzMbu2ajAcafEmBdP4FIi098supmaT2b49XAojjTqhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386007; 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-Type:Content-Transfer-Encoding; bh=cwSa8i3HzgWMLPZM523oFnpHXSHtNztOjdiwspYSpIs=; b=1XanRN7g+UCUtYExbm/wXg+ANzvgXqxTN2CnRiZmG0UQ65XxurRlakkpSgvlw/Oznfce atoZ9CunKWUSaBvHdewWI5NSTf9ZXCma142oie2iahYHVkRXpvNYSuzTqBdL1YR/09Mu6 CCcAS12/8PwdVYuyLqezgzMY2SYl8up3ads6gspAfx17TIb8+b9L1fWIM+by68/+fUpnC QORBlO9JSgVJxyBRlbk6gjkzfxW0l+LPF6EzuEgAZ7UEts9X6dPM3doZ/HxOuNl8k4tbC BOXYN86jukWJSTZQvSbWp56U8XThIITTYYc5iMBVymA6jbS5vvO9Xi8fxThkiClNBfg== 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=FCvemG7U; 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 66713606A322; Fri, 4 Dec 2026 12:06:47 +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=FCvemG7U Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9A101F000C2; Fri, 4 Dec 2026 12:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386007; bh=cwSa8i3HzgWMLPZM523oFnpHXSHtNztOjdiwspYSpIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FCvemG7UQb1mvT4lauZORrP4Gd1ZaDfu9o1jdr9AUu9mpuBzzIvb2UGXfBn3q5NEl /Vxqj8tgizRhv1pfDBngD6rdKCg6a5Y+PJ1TZsoH24t/QBUvF8yjXY+bwNYdyJJV+c FsSP5I0jvdXYhsFcrAu1RUzylKpKTfDQge3NB9Fs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Gregory Price (Meta)" , Zi Yan , "Vlastimil Babka (SUSE)" , Sasha Levin Subject: [PATCH 6.6 0786/1167] mm/page_alloc: dont undo another isolation in alloc_contig_range Date: Fri, 4 Dec 2026 19:03:33 +0900 Message-ID: <20261204100722.592513983@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gregory Price (Meta) [ Upstream commit 7d9c29ed8feec8bfbe5e5f673ba2b5926da11375 ] An alloc_contig_range() that overlaps a block going offline can leave the offline spinning until it gets a signal, holding the device hotplug lock. When isolation fails, alloc_contig_frozen_range() undoes it over the whole range, clearing the offline's MIGRATE_ISOLATE too: CPU 1 (offline_pages) CPU 2 (alloc_contig_range) start_isolate_page_range() blocks are MIGRATE_ISOLATE start_isolate_page_range() -EBUSY on CPU 1's blocks undo_isolate_page_range() blocks are MIGRATE_MOVABLE test_pages_isolated() never succeeds again start_isolate_page_range() fails only on a block someone else isolated, after undoing its own, so this undo only ever clears another caller's. Return directly, as before alloc_contig_range() went pageblock granular. With offline_pages() parked after isolating a DIMM block and a 1G hugetlb allocation made over it, the offline on base still loops 30s later in 4 of 4 runs: offline_pages+0x5b2/0x1570 memory_subsys_offline+0x17e/0x470 device_offline+0x250/0x340 state_store+0x88/0x110 With this patch the allocation still fails, and the offline completes in 3 of 3 runs. Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity") Cc: stable@vger.kernel.org Signed-off-by: Gregory Price (Meta) Link: https://patch.msgid.link/20261027042204.3741307-5-gourry@gourry.net Reviewed-by: Zi Yan Signed-off-by: Vlastimil Babka (SUSE) [ sashal: Used alloc_contig_range()’s start_isolate_page_range() call, which takes migratetype, 0, and gfp_mask in place of mode. ] Signed-off-by: Sasha Levin --- mm/page_alloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 77e2522a43ee2..8841d29345d13 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6294,9 +6294,13 @@ int alloc_contig_range(unsigned long start, unsigned long end, * put back to page allocator so that buddy can use them. */ + /* + * On failure this has undone its own isolation, and any other + * isolated blocks in the range belong to someone else, e.g. offline. + */ ret = start_isolate_page_range(start, end, migratetype, 0, gfp_mask); if (ret) - goto done; + return ret; drain_all_pages(cc.zone); -- 2.53.0