aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
authorDmitry Ilvokhin <d@ilvokhin.com>2026-04-29 12:02:12 +0000
committerAndrew Morton <akpm@linux-foundation.org>2026-05-28 21:05:06 -0700
commit5ad64655dde8e5416fc0fff51a189879fe3235fd (patch)
treedfdb81e963658f4e82943500383bcbf5c97943d2 /mm
parent5e22451096cd65ded8a7550fb324c8e6dc3b2b22 (diff)
downloadlinux-next-history-5ad64655dde8e5416fc0fff51a189879fe3235fd.tar.gz
mm: use zone lock guard in free_pcppages_bulk()
Use spinlock_irqsave zone lock guard in free_pcppages_bulk() to replace the explicit lock/unlock pattern with automatic scope-based cleanup. Link: https://lore.kernel.org/aafc2d660057a91eb40417f8ff4645b0a8c525e2.1777462630.git.d@ilvokhin.com Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com> Suggested-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Brendan Jackman <jackmanb@google.com> Cc: David Hildenbrand <david@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 49711916703ea..8835064aaa8c0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1469,7 +1469,6 @@ static void free_pcppages_bulk(struct zone *zone, int count,
struct per_cpu_pages *pcp,
int pindex)
{
- unsigned long flags;
unsigned int order;
struct page *page;
@@ -1482,7 +1481,7 @@ static void free_pcppages_bulk(struct zone *zone, int count,
/* Ensure requested pindex is drained first. */
pindex = pindex - 1;
- spin_lock_irqsave(&zone->lock, flags);
+ guard(spinlock_irqsave)(&zone->lock);
while (count > 0) {
struct list_head *list;
@@ -1514,8 +1513,6 @@ static void free_pcppages_bulk(struct zone *zone, int count,
trace_mm_page_pcpu_drain(page, order, mt);
} while (count > 0 && !list_empty(list));
}
-
- spin_unlock_irqrestore(&zone->lock, flags);
}
/* Split a multi-block free page into its individual pageblocks. */