From: Srinivas Pandruvada Date: Wed, 20 Feb 2013 02:13:58 +0000 (+1100) Subject: CMA: make putback_lru_pages() call conditional X-Git-Tag: next-20130220~1^2~593 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=eb0ee2ab3264e64fdcddd37efcadecb3e6bae9ce;p=karo-tx-linux.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. Signed-off-by: Srinivas Pandruvada Acked-by: Michal Nazarewicz Cc: Marek Szyprowski Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Andrew Morton --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 998d1141c764..5948a77994bb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5806,8 +5806,8 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, 0, false, MIGRATE_SYNC, MR_CMA); } - - putback_movable_pages(&cc->migratepages); + if (ret < 0) + putback_movable_pages(&cc->migratepages); return ret > 0 ? 0 : ret; }