Thread (24 messages) 24 messages, 4 authors, 2014-07-18
STALE4345d REVIEWED: 5 (2M)
Revisions (2)
  1. v2 [diff vs current]
  2. v3 current

[PATCH v3 -next 7/9] mm, CMA: clean-up CMA allocation error path

From: Joonsoo Kim <hidden>
Date: 2014-06-16 05:36:53
Also in: kvm, linux-mm, linuxppc-dev, lkml
Subsystem: memory management, memory management - misc, the rest · Maintainers: Andrew Morton, David Hildenbrand, Linus Torvalds

We can remove one call sites for clear_cma_bitmap() if we first
call it before checking error number.

Acked-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Michal Nazarewicz <redacted>
Reviewed-by: Zhang Yanfei <redacted>
Reviewed-by: Aneesh Kumar K.V <redacted>
Signed-off-by: Joonsoo Kim <redacted>
diff --git a/mm/cma.c b/mm/cma.c
index 0cf50da..b442a13 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -285,11 +285,12 @@ struct page *cma_alloc(struct cma *cma, int count, unsigned int align)
 		if (ret == 0) {
 			page = pfn_to_page(pfn);
 			break;
-		} else if (ret != -EBUSY) {
-			cma_clear_bitmap(cma, pfn, count);
-			break;
 		}
+
 		cma_clear_bitmap(cma, pfn, count);
+		if (ret != -EBUSY)
+			break;
+
 		pr_debug("%s(): memory range at %p is busy, retrying\n",
 			 __func__, pfn_to_page(pfn));
 		/* try again with a bit different memory target */
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help