|
@@ -1548,8 +1548,24 @@ split_fallthrough:
|
|
|
ptep = pte_offset_map_lock(mm, pmd, address, &ptl);
|
|
|
|
|
|
pte = *ptep;
|
|
|
- if (!pte_present(pte))
|
|
|
- goto no_page;
|
|
|
+ if (!pte_present(pte)) {
|
|
|
+ swp_entry_t entry;
|
|
|
+ /*
|
|
|
+ * KSM's break_ksm() relies upon recognizing a ksm page
|
|
|
+ * even while it is being migrated, so for that case we
|
|
|
+ * need migration_entry_wait().
|
|
|
+ */
|
|
|
+ if (likely(!(flags & FOLL_MIGRATION)))
|
|
|
+ goto no_page;
|
|
|
+ if (pte_none(pte) || pte_file(pte))
|
|
|
+ goto no_page;
|
|
|
+ entry = pte_to_swp_entry(pte);
|
|
|
+ if (!is_migration_entry(entry))
|
|
|
+ goto no_page;
|
|
|
+ pte_unmap_unlock(ptep, ptl);
|
|
|
+ migration_entry_wait(mm, pmd, address);
|
|
|
+ goto split_fallthrough;
|
|
|
+ }
|
|
|
if ((flags & FOLL_NUMA) && pte_numa(pte))
|
|
|
goto no_page;
|
|
|
if ((flags & FOLL_WRITE) && !pte_write(pte))
|