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 <minchan@google.com>
Change-Id: I9211452be06960dc7d8f854537e53b3fc5262c8e
This commit is contained in:
Minchan Kim
2021-07-12 16:06:34 -07:00
committed by Todd Kjos
parent 675e504598
commit c01ce3b5ef

View File

@@ -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;