Skip to contentSkip to conversation

mm-page_alloc-dont-spin_trylock-when-disallowed-in-free_one_page.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Aug 7 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/page_alloc: don't spin_trylock() when disallowed in free_one_page()
has been removed from the -mm tree. Its filename was
mm-page_alloc-dont-spin_trylock-when-disallowed-in-free_one_page.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Brendan Jackman <[email protected]>
Subject: mm/page_alloc: don't spin_trylock() when disallowed in free_one_page()
Date: Wed, 15 Jul 2026 09:03:59 +0000

__free_frozen_pages() checks can_spin_trylock() before entering into the main free_frozen_page_commit()/free_one_page() path, but before this it can get to free_one_page() via the !pcp_allowed_order() and MIGRATE_ISOLATE paths.

The !pcp_allowed_order() path depends on usage by callers so might not be possible in practice. The MIGRATE_ISOLATE path probably means kernel crashes and privilege escalation if anyone ever did memory hotplug and BPF tracing on a PREEMPT_RT or !SMP build.

---

 mm/page_alloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-dont-spin_trylock-when-disallowed-in-free_one_page +1 -1
@@ -1559,7 +1559,7 @@ static void free_one_page(struct zone *z
 	unsigned long flags;
 
 	if (unlikely(fpi_flags & FPI_TRYLOCK)) {
-		if (!spin_trylock_irqsave(&zone->lock, flags)) {
+		if (!can_spin_trylock() || !spin_trylock_irqsave(&zone->lock, flags)) {
 			add_page_to_zone_llist(zone, page, order);
 			return;
 		}

_

Patches currently in -mm which might be from [email protected] are