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=1796383087; b=FdqzkJM2na1SMeRrtQhl1wvSlpAVnxj5tjrj/QAcefPCZ3ZcDiYTAbysq7LjjfKqiWyg iVZBj6CpFemCm92AUO/ojAJV006rxQYIajwrdtqNpXJEACB8Vz8coU0G5R6J/+4ewztCS 6cyC7cWZhcKM+HJ1WDAS8Z2DzSaZZcPwqi/i6aGG8noUnVBfYnggK/obkk5pDxiAXxE9+ EIuo4TbOkxjax5dgucfhaPNftoK/IvDGiUOxvK4ZaVB6dN1NmLYhbYdx323Ee3JdZPISg ePwvD0eWqefa/QKQcEJu5rSbp2YfjuULpwd1xYMaTrs6fZeXft20xarZ2eAb3aPImpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383087; 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=UioGN78YCNZnETHoNSlEu5Sb3t0D+jzIhcPVmwjr434=; b=QfHYXf9DsnRvE8WXpuzjg8cv9edsheM+UvP2QwiOGpgNgDNXrd3jeAQEE+xue48j+OFc GOe+jXlw+Cvd1544Jss5cbjoSy9qKvIB0+8Q9cYcSKr2DbSZn/DykZta+NOqKAyIGBCLJ CYfkzWn8BhzYQJdR1Ou29ELGzIR5041nQ5BKVibayAR8RdczCnWhBx5ZG7OYs8hKFN4bd QKsornS1ZlcLSFB9XJUp3oAu+115jLpud0rowvW4r6c5ZIybnNJ7FK5hBr2aNcdiJlr++ E8CW5KtFvVHHftEZ/DeGploj/S9fUfbEXaUX/y7dGjrqaEXQODp2hhKwUN0TEPASTaw== 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=x5N0r04C; 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 57CB2606A334; Fri, 4 Dec 2026 11:18:07 +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=x5N0r04C Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBA41F000CE; Fri, 4 Dec 2026 11:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383087; bh=UioGN78YCNZnETHoNSlEu5Sb3t0D+jzIhcPVmwjr434=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=x5N0r04CnDWt1KgaL7kwIIZaTdAcPWdYcn1c4XTjKD77EUI/OV9T/0btoUgdT5ANf hePtCqinVFyrAKa6wRVoNct6MVZmWHycZYFfXDZ9GCOCqVDSUfTCjpHI9kRupe3MW3 R8EkWMwN9ivwqA0YSf8DdGdpN3WionELHURRYe84= 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.12 082/555] mm/page_alloc: dont undo another isolation in alloc_contig_range Date: Fri, 4 Dec 2026 19:02:05 +0900 Message-ID: <20261204100610.305342525@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: 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: Adjusted the context to match the existing five-argument start_isolate_page_range() call in alloc_contig_range_noprof(). ] 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 6aada2df1a1c0..9615e2b3def5b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6817,9 +6817,13 @@ int alloc_contig_range_noprof(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