Skip to content

Commit dbdc7f0

Browse files
kongsuozttobetter
authored andcommitted
mm: fix dead loop if signal pending for cma alloc task [1/1]
PD#GH-17 Problem: If a task be killed during CMA allocation, then it will abort cma allocation in function compact_unlock_should_abort. But in function aml_cma_alloc_range, it will return -EBUSY. Which cause cma allocation loop won't exit and run again and again. Solution: return -EINT for this case to exit cma allocaion loop. Verify: newman platform Change-Id: I6559bb184fc035ae68c8ccd001407767e1e22f0c Signed-off-by: Tao Zeng <[email protected]>
1 parent 62231b4 commit dbdc7f0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/amlogic/memory_ext/aml_cma.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ int aml_cma_alloc_range(unsigned long start, unsigned long end)
577577
.mode = MIGRATE_SYNC,
578578
.page_type = COMPACT_CMA,
579579
.ignore_skip_hint = true,
580+
.contended = false,
580581
};
581582
INIT_LIST_HEAD(&cc.migratepages);
582583

@@ -611,11 +612,8 @@ int aml_cma_alloc_range(unsigned long start, unsigned long end)
611612
outer_start = start;
612613
while (!PageBuddy(pfn_to_page(outer_start))) {
613614
if (++order >= MAX_ORDER) {
614-
ret = -EBUSY;
615-
try_times++;
616-
if (try_times < 10)
617-
goto try_again;
618-
goto done;
615+
outer_start = start;
616+
break;
619617
}
620618
outer_start &= ~0UL << order;
621619
}
@@ -647,7 +645,11 @@ int aml_cma_alloc_range(unsigned long start, unsigned long end)
647645
/* Grab isolated pages from freelists. */
648646
outer_end = isolate_freepages_range(&cc, outer_start, end);
649647
if (!outer_end) {
650-
ret = -EBUSY;
648+
if (cc.contended) {
649+
ret = -EINTR;
650+
pr_info("cma_alloc [%lx-%lx] aborted\n", start, end);
651+
} else
652+
ret = -EBUSY;
651653
goto done;
652654
}
653655

0 commit comments

Comments
 (0)