mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
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>
This commit is contained in:
parent
5e22451096
commit
5ad64655dd
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user