Skip to content

Commit

Permalink
mm/compaction: check migrate_pages's return value instead of list_emp…
Browse files Browse the repository at this point in the history
…ty()

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 <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Minchan Kim authored and torvalds committed Mar 23, 2011
1 parent d527caf commit 9d502c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,13 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)

while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) {
unsigned long nr_migrate, nr_remaining;
int err;

if (!isolate_migratepages(zone, cc))
continue;

nr_migrate = cc->nr_migratepages;
migrate_pages(&cc->migratepages, compaction_alloc,
err = migrate_pages(&cc->migratepages, compaction_alloc,
(unsigned long)cc, false,
cc->sync);
update_nr_listpages(cc);
Expand All @@ -513,7 +514,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
nr_remaining);

/* Release LRU pages not migrated */
if (!list_empty(&cc->migratepages)) {
if (err) {
putback_lru_pages(&cc->migratepages);
cc->nr_migratepages = 0;
}
Expand Down

0 comments on commit 9d502c1

Please sign in to comment.