diff options
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/pgtable.h | 3 | ||||
-rw-r--r-- | include/asm-generic/pgtable.h | 12 | ||||
-rw-r--r-- | mm/huge_memory.c | 18 |
3 files changed, 18 insertions, 15 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 9fd77f8794a0..700301bc5190 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h | |||
@@ -1009,7 +1009,8 @@ static inline void pmdp_huge_split_prepare(struct vm_area_struct *vma, | |||
1009 | #define pmd_move_must_withdraw pmd_move_must_withdraw | 1009 | #define pmd_move_must_withdraw pmd_move_must_withdraw |
1010 | struct spinlock; | 1010 | struct spinlock; |
1011 | static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | 1011 | static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, |
1012 | struct spinlock *old_pmd_ptl) | 1012 | struct spinlock *old_pmd_ptl, |
1013 | struct vm_area_struct *vma) | ||
1013 | { | 1014 | { |
1014 | if (radix_enabled()) | 1015 | if (radix_enabled()) |
1015 | return false; | 1016 | return false; |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 41b95d82a185..2065e81701fc 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -652,18 +652,6 @@ static inline pmd_t pmd_read_atomic(pmd_t *pmdp) | |||
652 | } | 652 | } |
653 | #endif | 653 | #endif |
654 | 654 | ||
655 | #ifndef pmd_move_must_withdraw | ||
656 | static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl, | ||
657 | spinlock_t *old_pmd_ptl) | ||
658 | { | ||
659 | /* | ||
660 | * With split pmd lock we also need to move preallocated | ||
661 | * PTE page table if new_pmd is on different PMD page table. | ||
662 | */ | ||
663 | return new_pmd_ptl != old_pmd_ptl; | ||
664 | } | ||
665 | #endif | ||
666 | |||
667 | /* | 655 | /* |
668 | * This function is meant to be used by sites walking pagetables with | 656 | * This function is meant to be used by sites walking pagetables with |
669 | * the mmap_sem hold in read mode to protect against MADV_DONTNEED and | 657 | * the mmap_sem hold in read mode to protect against MADV_DONTNEED and |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 26fd1161ca85..b54044c21076 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1429,6 +1429,21 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, | |||
1429 | return 1; | 1429 | return 1; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | #ifndef pmd_move_must_withdraw | ||
1433 | static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl, | ||
1434 | spinlock_t *old_pmd_ptl, | ||
1435 | struct vm_area_struct *vma) | ||
1436 | { | ||
1437 | /* | ||
1438 | * With split pmd lock we also need to move preallocated | ||
1439 | * PTE page table if new_pmd is on different PMD page table. | ||
1440 | * | ||
1441 | * We also don't deposit and withdraw tables for file pages. | ||
1442 | */ | ||
1443 | return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma); | ||
1444 | } | ||
1445 | #endif | ||
1446 | |||
1432 | bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, | 1447 | bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, |
1433 | unsigned long new_addr, unsigned long old_end, | 1448 | unsigned long new_addr, unsigned long old_end, |
1434 | pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush) | 1449 | 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, | |||
1466 | force_flush = true; | 1481 | force_flush = true; |
1467 | VM_BUG_ON(!pmd_none(*new_pmd)); | 1482 | VM_BUG_ON(!pmd_none(*new_pmd)); |
1468 | 1483 | ||
1469 | if (pmd_move_must_withdraw(new_ptl, old_ptl) && | 1484 | if (pmd_move_must_withdraw(new_ptl, old_ptl, vma)) { |
1470 | vma_is_anonymous(vma)) { | ||
1471 | pgtable_t pgtable; | 1485 | pgtable_t pgtable; |
1472 | pgtable = pgtable_trans_huge_withdraw(mm, old_pmd); | 1486 | pgtable = pgtable_trans_huge_withdraw(mm, old_pmd); |
1473 | pgtable_trans_huge_deposit(mm, new_pmd, pgtable); | 1487 | pgtable_trans_huge_deposit(mm, new_pmd, pgtable); |