|
@@ -146,8 +146,11 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
|
|
pte = pte_mkold(mk_pte(new, vma->vm_page_prot));
|
|
pte = pte_mkold(mk_pte(new, vma->vm_page_prot));
|
|
if (pte_swp_soft_dirty(*ptep))
|
|
if (pte_swp_soft_dirty(*ptep))
|
|
pte = pte_mksoft_dirty(pte);
|
|
pte = pte_mksoft_dirty(pte);
|
|
|
|
+
|
|
|
|
+ /* Recheck VMA as permissions can change since migration started */
|
|
if (is_write_migration_entry(entry))
|
|
if (is_write_migration_entry(entry))
|
|
- pte = pte_mkwrite(pte);
|
|
|
|
|
|
+ pte = maybe_mkwrite(pte, vma);
|
|
|
|
+
|
|
#ifdef CONFIG_HUGETLB_PAGE
|
|
#ifdef CONFIG_HUGETLB_PAGE
|
|
if (PageHuge(new)) {
|
|
if (PageHuge(new)) {
|
|
pte = pte_mkhuge(pte);
|
|
pte = pte_mkhuge(pte);
|