mm/gup: check FOLL_CMA eariler than others
authorCho KyongHo <pullip.cho@samsung.com>
Mon, 20 Aug 2018 12:43:19 +0000 (21:43 +0900)
committerhskang <hs1218.kang@samsung.com>
Mon, 27 Aug 2018 07:22:03 +0000 (16:22 +0900)
__need_migrate_cma_page() checks a lot of conditions if the current
get_user_pages() request need to migrate CMA pages to some other pages.
But FOLL_CMA is given by very few users. We don't need to spend time
for condition check for the users without FOLL_CMA.

Change-Id: I973b3c99140e71fbf78cb6280e94ef5e97c9824a
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
mm/gup.c

index fce3dc20be8875d64e639fca24b7323a0e602742..62d38d58dbdd32dffe311d3eb76bfa715f45bbf6 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -36,19 +36,16 @@ static bool __need_migrate_cma_page(struct page *page,
                                struct vm_area_struct *vma,
                                unsigned long start, unsigned int flags)
 {
-       if (!(flags & FOLL_GET))
+       if (!(flags & (FOLL_GET | FOLL_CMA)))
                return false;
 
-       if (get_pageblock_migratetype(page) != MIGRATE_CMA)
+       if (!is_migrate_cma_page(page))
                return false;
 
        if ((vma->vm_flags & VM_STACK_INCOMPLETE_SETUP) ==
                                        VM_STACK_INCOMPLETE_SETUP)
                return false;
 
-       if (!(flags & FOLL_CMA))
-               return false;
-
        if (!PageLRU(page)) {
                migrate_prep_local();
                if (WARN_ON(!PageLRU(page))) {