* FAILED: patch "[PATCH] mm/page_alloc: don't undo another isolation in" failed to apply to 6.6-stable tree
@ 2026-11-24 15:38 gregkh
2026-11-24 20:22 ` [PATCH 6.6.y] mm/page_alloc: don't undo another isolation in alloc_contig_range Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-11-24 15:38 UTC (permalink / raw)
To: gourry, vbabka, ziy; +Cc: stable
The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 7d9c29ed8feec8bfbe5e5f673ba2b5926da11375
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026112444-removable-storm-556a@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7d9c29ed8feec8bfbe5e5f673ba2b5926da11375 Mon Sep 17 00:00:00 2001
From: "Gregory Price (Meta)" <gourry@gourry.net>
Date: Tue, 27 Oct 2026 00:22:02 -0400
Subject: [PATCH] mm/page_alloc: don't undo another isolation in
alloc_contig_range
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) <gourry@gourry.net>
Link: https://patch.msgid.link/20261027042204.3741307-5-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6f10cc628177..cc291016ea03 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7364,9 +7364,13 @@ int alloc_contig_frozen_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, mode);
if (ret)
- goto done;
+ return ret;
drain_all_pages(cc.zone);
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 6.6.y] mm/page_alloc: don't undo another isolation in alloc_contig_range
2026-11-24 15:38 FAILED: patch "[PATCH] mm/page_alloc: don't undo another isolation in" failed to apply to 6.6-stable tree gregkh
@ 2026-11-24 20:22 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-24 20:22 UTC (permalink / raw)
To: stable; +Cc: Gregory Price (Meta), Zi Yan, Vlastimil Babka (SUSE), Sasha Levin
From: "Gregory Price (Meta)" <gourry@gourry.net>
[ 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) <gourry@gourry.net>
Link: https://patch.msgid.link/20261027042204.3741307-5-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ 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 <sashal@kernel.org>
---
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 50cb81d42b1c0..02bdbe9cc5426 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6264,9 +6264,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-24 20:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 15:38 FAILED: patch "[PATCH] mm/page_alloc: don't undo another isolation in" failed to apply to 6.6-stable tree gregkh
2026-11-24 20:22 ` [PATCH 6.6.y] mm/page_alloc: don't undo another isolation in alloc_contig_range Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox