[COMMON] mm: fix cma page migration race condition
The below callstack makes VM_BUG_ON in race condition.
So this fixes it by moving the page isolation into before
pte_unmap_unlock().
----------------------------------------------------------
CPU0 CPU1
__need_migrate_cma_page
PageLRU(page)
pte_unmap_unlock
isolate_migrate_pages_range
migrate_pages # clear pageLRU
# _count == 0
__migrate_cma_pinpage
__isolate_lru_page # failure on !PageLRU
get_page_foll # VM_BUG on page->_count == 0
----------------------------------------------------------
This patch effects that get_user_pages() may stop on a page that is
under a racing but it guarantees that the state of the page is
consistent. Therefore, the caller of get_user_pages() should always
check if the pinning all required pages is successful.
Change-Id: I7947db746e8aaed23ea7344ee0483073bbd2d51c
Signed-off-by: Sunyoung Kang <sy0816.kang@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>