Skip to contentSkip to conversation

mm-use-zone-lock-guard-in-take_page_off_buddy.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 take_page_off_buddy()
has been removed from the -mm tree. Its filename was
mm-use-zone-lock-guard-in-take_page_off_buddy.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 take_page_off_buddy()
Date: Wed, 29 Apr 2026 12:02:10 +0000

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

This also allows to return directly from the loop, removing the 'ret' variable.

---

 mm/page_alloc.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-use-zone-lock-guard-in-take_page_off_buddy +3 -7
@@ -7644,11 +7644,9 @@ bool take_page_off_buddy(struct page *pa
 {
 	struct zone *zone = page_zone(page);
 	unsigned long pfn = page_to_pfn(page);
-	unsigned long flags;
 	unsigned int order;
-	bool ret = false;
 
-	spin_lock_irqsave(&zone->lock, flags);
+	guard(spinlock_irqsave)(&zone->lock);
 	for (order = 0; order < NR_PAGE_ORDERS; order++) {
 		struct page *page_head = page - (pfn & ((1 << order) - 1));
 		int page_order = buddy_order(page_head);
@@ -7663,14 +7661,12 @@ bool take_page_off_buddy(struct page *pa
 			break_down_buddy_pages(zone, page_head, page, 0,
 						page_order, migratetype);
 			SetPageHWPoisonTakenOff(page);
-			ret = true;
-			break;
+			return true;
 		}
 		if (page_count(page_head) > 0)
 			break;
 	}
-	spin_unlock_irqrestore(&zone->lock, flags);
-	return ret;
+	return false;
 }
 
 /*

_

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

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