Commit 1c31cb49 authored by David Hildenbrand's avatar David Hildenbrand Committed by Linus Torvalds

mm/page_isolation: cleanup set_migratetype_isolate()

Let's clean it up a bit, simplifying the exit paths.
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarBaoquan He <bhe@redhat.com>
Reviewed-by: default avatarPankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Qian Cai <cai@lca.pw>
Link: http://lkml.kernel.org/r/20200816125333.7434-5-david@redhat.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 48381d7e
...@@ -17,12 +17,9 @@ ...@@ -17,12 +17,9 @@
static int set_migratetype_isolate(struct page *page, int migratetype, int isol_flags) static int set_migratetype_isolate(struct page *page, int migratetype, int isol_flags)
{ {
struct page *unmovable = NULL; struct zone *zone = page_zone(page);
struct zone *zone; struct page *unmovable;
unsigned long flags; unsigned long flags;
int ret = -EBUSY;
zone = page_zone(page);
spin_lock_irqsave(&zone->lock, flags); spin_lock_irqsave(&zone->lock, flags);
...@@ -51,13 +48,13 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ ...@@ -51,13 +48,13 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_
NULL); NULL);
__mod_zone_freepage_state(zone, -nr_pages, mt); __mod_zone_freepage_state(zone, -nr_pages, mt);
ret = 0; spin_unlock_irqrestore(&zone->lock, flags);
drain_all_pages(zone);
return 0;
} }
spin_unlock_irqrestore(&zone->lock, flags); spin_unlock_irqrestore(&zone->lock, flags);
if (!ret) { if (isol_flags & REPORT_FAILURE) {
drain_all_pages(zone);
} else if ((isol_flags & REPORT_FAILURE) && unmovable) {
/* /*
* printk() with zone->lock held will likely trigger a * printk() with zone->lock held will likely trigger a
* lockdep splat, so defer it here. * lockdep splat, so defer it here.
...@@ -65,7 +62,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ ...@@ -65,7 +62,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_
dump_page(unmovable, "unmovable page"); dump_page(unmovable, "unmovable page");
} }
return ret; return -EBUSY;
} }
static void unset_migratetype_isolate(struct page *page, unsigned migratetype) static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment