Skip to contentSkip to conversation

mm-use-zone-lock-guard-in-reserve_highatomic_pageblock.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: use zone lock guard in reserve_highatomic_pageblock()
has been removed from the -mm tree. Its filename was
mm-use-zone-lock-guard-in-reserve_highatomic_pageblock.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: Dmitry Ilvokhin <[email protected]>
Subject: mm: use zone lock guard in reserve_highatomic_pageblock()
Date: Wed, 29 Apr 2026 12:02:06 +0000

Patch series "mm: use spinlock guards for zone lock", v3.

This series uses spinlock guard for zone lock across several mm functions to replace explicit lock/unlock patterns with automatic scope-based cleanup.

This simplifies the control flow by removing 'flags' variables, goto labels, and redundant unlock calls.

Patches are ordered by decreasing value. The first six patches simplify the control flow by removing gotos, multiple unlock paths, or 'ret' variables. The last two are simpler lock/unlock pair conversions that only remove 'flags' and can be dropped if considered unnecessary churn.

Binary size increase is +39 bytes, with Peter Zijlstra's fix for guards
[1] applied. This is due to the compiler not being able to deduplicate epilogue and eliminate redundant NULL check. See discussion [2] for more details. I proposed a patch [3] that fixes this, but until it is merged we need to assume +39 bytes will stay (though it is compiler dependent).

This patch (of 8):

Use the spinlock_irqsave zone lock guard in reserve_highatomic_pageblock() to replace the explicit lock/unlock and goto out_unlock pattern with automatic scope-based cleanup.

---

 mm/page_alloc.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-use-zone-lock-guard-in-reserve_highatomic_pageblock +5 -8
@@ -3442,7 +3442,7 @@ static void reserve_highatomic_pageblock
 					 struct zone *zone)
 {
 	int mt;
-	unsigned long max_managed, flags;
+	unsigned long max_managed;
 
 	/*
 	 * The number reserved as: minimum is 1 pageblock, maximum is
@@ -3456,29 +3456,26 @@ static void reserve_highatomic_pageblock
 	if (zone->nr_reserved_highatomic >= max_managed)
 		return;
 
-	spin_lock_irqsave(&zone->lock, flags);
+	guard(spinlock_irqsave)(&zone->lock);
 
 	/* Recheck the nr_reserved_highatomic limit under the lock */
 	if (zone->nr_reserved_highatomic >= max_managed)
-		goto out_unlock;
+		return;
 
 	/* Yoink! */
 	mt = get_pageblock_migratetype(page);
 	/* Only reserve normal pageblocks (i.e., they can merge with others) */
 	if (!migratetype_is_mergeable(mt))
-		goto out_unlock;
+		return;
 
 	if (order < pageblock_order) {
 		if (move_freepages_block(zone, page, mt, MIGRATE_HIGHATOMIC) == -1)
-			goto out_unlock;
+			return;
 		zone->nr_reserved_highatomic += pageblock_nr_pages;
 	} else {
 		change_pageblock_range(page, order, MIGRATE_HIGHATOMIC);
 		zone->nr_reserved_highatomic += 1 << order;
 	}
-
-out_unlock:
-	spin_unlock_irqrestore(&zone->lock, flags);
 }
 
 /*

_

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

mm-page_alloc-fix-defrag_mode-for-non-reclaimable-allocations.patch