OSDN Git Service

Merge 4.4.163 into android-4.4-p
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / mm / huge_memory.c
index 67f5a8c..b2d56b1 100644 (file)
@@ -1510,7 +1510,7 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma,
        spinlock_t *old_ptl, *new_ptl;
        int ret = 0;
        pmd_t pmd;
-
+       bool force_flush = false;
        struct mm_struct *mm = vma->vm_mm;
 
        if ((old_addr & ~HPAGE_PMD_MASK) ||
@@ -1538,6 +1538,8 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma,
                if (new_ptl != old_ptl)
                        spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);
                pmd = pmdp_huge_get_and_clear(mm, old_addr, old_pmd);
+               if (pmd_present(pmd))
+                       force_flush = true;
                VM_BUG_ON(!pmd_none(*new_pmd));
 
                if (pmd_move_must_withdraw(new_ptl, old_ptl)) {
@@ -1546,6 +1548,8 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma,
                        pgtable_trans_huge_deposit(mm, new_pmd, pgtable);
                }
                set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd));
+               if (force_flush)
+                       flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE);
                if (new_ptl != old_ptl)
                        spin_unlock(new_ptl);
                spin_unlock(old_ptl);