From: Srinivas Pandruvada Date: Sat, 23 Feb 2013 00:32:09 +0000 (-0800) Subject: CMA: make putback_lru_pages() call conditional X-Git-Tag: upstream/snapshot3+hdmi~5668^2~149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a6f512412c7aecd04134721ea392cc496e6c017;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git CMA: make putback_lru_pages() call conditional As per documentation and other places calling putback_lru_pages(), putback_lru_pages() is called on error only. Make the CMA code behave consistently. [akpm@linux-foundation.org: remove a test-n-branch in the wrapup code] Signed-off-by: Srinivas Pandruvada Acked-by: Michal Nazarewicz Cc: Marek Szyprowski Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d1107ad..804cc62 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -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; } /**