Commit 9d502c1c authored by Minchan Kim's avatar Minchan Kim Committed by Linus Torvalds

mm/compaction: check migrate_pages's return value instead of list_empty()

Many migrate_page's caller check return value instead of list_empy by
cf608ac1 ("mm: compaction: fix COMPACTPAGEFAILED counting").  This patch
makes compaction's migrate_pages consistent with others.  This patch
should not change old behavior.
Signed-off-by: default avatarMinchan Kim <minchan.kim@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d527caf2
...@@ -494,12 +494,13 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) ...@@ -494,12 +494,13 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) { while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) {
unsigned long nr_migrate, nr_remaining; unsigned long nr_migrate, nr_remaining;
int err;
if (!isolate_migratepages(zone, cc)) if (!isolate_migratepages(zone, cc))
continue; continue;
nr_migrate = cc->nr_migratepages; nr_migrate = cc->nr_migratepages;
migrate_pages(&cc->migratepages, compaction_alloc, err = migrate_pages(&cc->migratepages, compaction_alloc,
(unsigned long)cc, false, (unsigned long)cc, false,
cc->sync); cc->sync);
update_nr_listpages(cc); update_nr_listpages(cc);
...@@ -513,7 +514,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) ...@@ -513,7 +514,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
nr_remaining); nr_remaining);
/* Release LRU pages not migrated */ /* Release LRU pages not migrated */
if (!list_empty(&cc->migratepages)) { if (err) {
putback_lru_pages(&cc->migratepages); putback_lru_pages(&cc->migratepages);
cc->nr_migratepages = 0; cc->nr_migratepages = 0;
} }
......
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