]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - mm/huge_memory.c
mm: move vma_is_anonymous check within pmd_move_must_withdraw
[mirror_ubuntu-zesty-kernel.git] / mm / huge_memory.c
index 26fd1161ca85fa75dc7da9cad2a2603b7587abbb..b54044c210761a7bf0852422a404594610499a11 100644 (file)
@@ -1429,6 +1429,21 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
        return 1;
 }
 
+#ifndef pmd_move_must_withdraw
+static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
+                                        spinlock_t *old_pmd_ptl,
+                                        struct vm_area_struct *vma)
+{
+       /*
+        * With split pmd lock we also need to move preallocated
+        * PTE page table if new_pmd is on different PMD page table.
+        *
+        * We also don't deposit and withdraw tables for file pages.
+        */
+       return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma);
+}
+#endif
+
 bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
                  unsigned long new_addr, unsigned long old_end,
                  pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush)
@@ -1466,8 +1481,7 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
                        force_flush = true;
                VM_BUG_ON(!pmd_none(*new_pmd));
 
-               if (pmd_move_must_withdraw(new_ptl, old_ptl) &&
-                               vma_is_anonymous(vma)) {
+               if (pmd_move_must_withdraw(new_ptl, old_ptl, vma)) {
                        pgtable_t pgtable;
                        pgtable = pgtable_trans_huge_withdraw(mm, old_pmd);
                        pgtable_trans_huge_deposit(mm, new_pmd, pgtable);