diff options
Diffstat (limited to 'mm/migrate.c')
-rw-r--r-- | mm/migrate.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index 4389696fba0e..5d1839a9148d 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1324,8 +1324,19 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, | |||
1324 | goto put_anon; | 1324 | goto put_anon; |
1325 | 1325 | ||
1326 | if (page_mapped(hpage)) { | 1326 | if (page_mapped(hpage)) { |
1327 | struct address_space *mapping = page_mapping(hpage); | ||
1328 | |||
1329 | /* | ||
1330 | * try_to_unmap could potentially call huge_pmd_unshare. | ||
1331 | * Because of this, take semaphore in write mode here and | ||
1332 | * set TTU_RMAP_LOCKED to let lower levels know we have | ||
1333 | * taken the lock. | ||
1334 | */ | ||
1335 | i_mmap_lock_write(mapping); | ||
1327 | try_to_unmap(hpage, | 1336 | try_to_unmap(hpage, |
1328 | TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS); | 1337 | TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS| |
1338 | TTU_RMAP_LOCKED); | ||
1339 | i_mmap_unlock_write(mapping); | ||
1329 | page_was_mapped = 1; | 1340 | page_was_mapped = 1; |
1330 | } | 1341 | } |
1331 | 1342 | ||