mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 12:11:59 +02:00
mm: use zone lock guard in unset_migratetype_isolate()
Use spinlock_irqsave zone lock guard in unset_migratetype_isolate() to replace the explicit lock/unlock and goto pattern with automatic scope-based cleanup. Link: https://lore.kernel.org/815c0905ea77828ed32bf56ff0a6d3c6548eb3a2.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> Acked-by: Zi Yan <ziy@nvidia.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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
5ebb2064da
commit
3a92b4e99b
|
|
@ -223,15 +223,14 @@ static int set_migratetype_isolate(struct page *page, enum pb_isolate_mode mode,
|
|||
static void unset_migratetype_isolate(struct page *page)
|
||||
{
|
||||
struct zone *zone;
|
||||
unsigned long flags;
|
||||
bool isolated_page = false;
|
||||
unsigned int order;
|
||||
struct page *buddy;
|
||||
|
||||
zone = page_zone(page);
|
||||
spin_lock_irqsave(&zone->lock, flags);
|
||||
guard(spinlock_irqsave)(&zone->lock);
|
||||
if (!is_migrate_isolate_page(page))
|
||||
goto out;
|
||||
return;
|
||||
|
||||
/*
|
||||
* Because freepage with more than pageblock_order on isolated
|
||||
|
|
@ -279,8 +278,6 @@ static void unset_migratetype_isolate(struct page *page)
|
|||
__putback_isolated_page(page, order, get_pageblock_migratetype(page));
|
||||
}
|
||||
zone->nr_isolate_pageblock--;
|
||||
out:
|
||||
spin_unlock_irqrestore(&zone->lock, flags);
|
||||
}
|
||||
|
||||
static inline struct page *
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user