From 54261b6432159003546e392c1f2a3fa94ed43240 Mon Sep 17 00:00:00 2001 From: Vinayak Menon Date: Wed, 8 Aug 2018 13:23:23 +0530 Subject: [PATCH] mm: cma: retry only on EBUSY Retry the cma alloc only when alloc_contig_range returns -EBUSY. This avoids unnecessary retries when the heap is full. Change-Id: If4626f0a0bc14e4b3a500283eb5a4c33b78fb6f2 Signed-off-by: Vinayak Menon --- mm/cma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/cma.c b/mm/cma.c index 57e8ec5e8c84..9222df77fd3c 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -480,7 +480,8 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, bitmap_maxno, start, bitmap_count, mask, offset); if (bitmap_no >= bitmap_maxno) { - if (retry_after_sleep < max_retries) { + if ((retry_after_sleep < max_retries) && + (ret == -EBUSY)) { start = 0; /* * update max retries if available free regions