Skip to content

Commit

Permalink
CMA: make putback_lru_pages() call conditional
Browse files Browse the repository at this point in the history
As per documentation and other places calling putback_lru_pages(),
putback_lru_pages() is called on error only.  Make the CMA code behave
consistently.

[[email protected]: remove a test-n-branch in the wrapup code]
Signed-off-by: Srinivas Pandruvada <[email protected]>
Acked-by: Michal Nazarewicz <[email protected]>
Cc: Marek Szyprowski <[email protected]>
Cc: Bartlomiej Zolnierkiewicz <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
spandruvada authored and torvalds committed Feb 24, 2013
1 parent ffb22af commit 2a6f512
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5806,9 +5806,11 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
0, false, MIGRATE_SYNC,
MR_CMA);
}

putback_movable_pages(&cc->migratepages);
return ret > 0 ? 0 : ret;
if (ret < 0) {
putback_movable_pages(&cc->migratepages);
return ret;
}
return 0;
}

/**
Expand Down

0 comments on commit 2a6f512

Please sign in to comment.