Skip to content

Commit 9d502c1

Browse files
Minchan Kimtorvalds
authored andcommitted
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 cf608ac ("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: Minchan 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d527caf commit 9d502c1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎mm/compaction.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,13 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
494494

495495
while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) {
496496
unsigned long nr_migrate, nr_remaining;
497+
int err;
497498

498499
if (!isolate_migratepages(zone, cc))
499500
continue;
500501

501502
nr_migrate = cc->nr_migratepages;
502-
migrate_pages(&cc->migratepages, compaction_alloc,
503+
err = migrate_pages(&cc->migratepages, compaction_alloc,
503504
(unsigned long)cc, false,
504505
cc->sync);
505506
update_nr_listpages(cc);
@@ -513,7 +514,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
513514
nr_remaining);
514515

515516
/* Release LRU pages not migrated */
516-
if (!list_empty(&cc->migratepages)) {
517+
if (err) {
517518
putback_lru_pages(&cc->migratepages);
518519
cc->nr_migratepages = 0;
519520
}

0 commit comments

Comments
 (0)