From c01ce3b5ef6cd9fdc015afc0bbb6d17b3aa49fb9 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Mon, 12 Jul 2021 16:06:34 -0700 Subject: [PATCH] ANDROID: mm: do not try test_page_isoalte if migration fails Currently, alloc_contig_range expects that even though a page fails with -EBUSY from __alloc_contig_migrate_range, it want to check those failed pages in test_pages_isolated again with hope that those page would be freed soon so cma allocatoin would be succeeded. However, it depends on the luck and I found sometimes test_page_isolated constantly fails at the page repeatedly whenever cma_alloc retried. Rather than burning out CPU to check the page's status in test_pages_isolated for GFP_NORETRY allocation, just bail out and relies on the user what they want to do. Currently, this option works for only __GFP_NORETRY case for safe of existing other users. Bug: 192475091 Signed-off-by: Minchan Kim Change-Id: I9211452be06960dc7d8f854537e53b3fc5262c8e --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a0cf1738bdb2..7c01170eeca5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8738,7 +8738,7 @@ int alloc_contig_range(unsigned long start, unsigned long end, * -EBUSY is not accidentally used or returned to caller. */ ret = __alloc_contig_migrate_range(&cc, start, end, info); - if (ret && ret != -EBUSY) + if (ret && (ret != -EBUSY || (gfp_mask & __GFP_NORETRY))) goto done; ret =0;