ANDROID: mm: fix cma_range_alloc retry logic

Custom retry mechanism introduced in [1] resets area start location to
0 to restart the search. However a recent upstream change [2] overrides
this start position. Bypass this override by directly jumping to the
beginning of the loop.

[1] https://android-review.googlesource.com/c/kernel/common/+/1431535
[2] 6972706f95 ("mm/cma: refuse handing out non-contiguous page ranges")

Bug: 519463493
Reported-by: yulijie1 <yulijie1@xiaomi.com>
Change-Id: Iaee1d5344ca4f5cb2172b7ff5c5257b1a4786c67
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan committed 2026-06-04 21:59:52 +00:00
1 parent 693ecf95d0
commit 0bbc2226d2
1 file changed
+2 -1
+2 -1
View File
@@ -804,6 +804,7 @@ static int cma_range_alloc(struct cma *cma, struct cma_memrange *cmr,
goto out;
for (start = 0; ; start = bitmap_no + mask + 1) {
retry:
spin_lock_irq(&cma->lock);
/*
* If the request is larger than the available number
@@ -835,7 +836,7 @@ static int cma_range_alloc(struct cma *cma, struct cma_memrange *cmr,
ret = -ENOMEM;
schedule_timeout_killable(msecs_to_jiffies(100));
num_attempts++;
continue;
goto retry;
} else {
spin_unlock_irq(&cma->lock);
break;