diff options
| author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-10-24 04:52:29 -0400 |
|---|---|---|
| committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-10-27 08:27:30 -0400 |
| commit | fcbe08d66f57c368e77ca729dd01e6b539ffb3ff (patch) | |
| tree | 202c07aac6f67b5b34372da6f80cf9baa773e307 | |
| parent | 6972cae523de728ad5e8dae01da4a631d98b874c (diff) | |
s390/mm: pmdp_get_and_clear_full optimization
Analog to ptep_get_and_clear_full define a variant of the
pmpd_get_and_clear primitive which gets the full hint from the
mmu_gather struct. This allows s390 to avoid a costly instruction
when destroying an address space.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
| -rw-r--r-- | arch/s390/include/asm/pgtable.h | 13 | ||||
| -rw-r--r-- | include/asm-generic/pgtable.h | 11 | ||||
| -rw-r--r-- | mm/huge_memory.c | 3 |
3 files changed, 26 insertions, 1 deletions
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 5ef1a266936a..5e102422c9ab 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
| @@ -1651,6 +1651,19 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, | |||
| 1651 | return pmd; | 1651 | return pmd; |
| 1652 | } | 1652 | } |
| 1653 | 1653 | ||
| 1654 | #define __HAVE_ARCH_PMDP_GET_AND_CLEAR_FULL | ||
| 1655 | static inline pmd_t pmdp_get_and_clear_full(struct mm_struct *mm, | ||
| 1656 | unsigned long address, | ||
| 1657 | pmd_t *pmdp, int full) | ||
| 1658 | { | ||
| 1659 | pmd_t pmd = *pmdp; | ||
| 1660 | |||
| 1661 | if (!full) | ||
| 1662 | pmdp_flush_lazy(mm, address, pmdp); | ||
| 1663 | pmd_clear(pmdp); | ||
| 1664 | return pmd; | ||
| 1665 | } | ||
| 1666 | |||
| 1654 | #define __HAVE_ARCH_PMDP_CLEAR_FLUSH | 1667 | #define __HAVE_ARCH_PMDP_CLEAR_FLUSH |
| 1655 | static inline pmd_t pmdp_clear_flush(struct vm_area_struct *vma, | 1668 | static inline pmd_t pmdp_clear_flush(struct vm_area_struct *vma, |
| 1656 | unsigned long address, pmd_t *pmdp) | 1669 | unsigned long address, pmd_t *pmdp) |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 752e30d63904..177d5973b132 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
| @@ -103,6 +103,17 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, | |||
| 103 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 103 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
| 104 | #endif | 104 | #endif |
| 105 | 105 | ||
| 106 | #ifndef __HAVE_ARCH_PMDP_GET_AND_CLEAR_FULL | ||
| 107 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
| 108 | static inline pmd_t pmdp_get_and_clear_full(struct mm_struct *mm, | ||
| 109 | unsigned long address, pmd_t *pmdp, | ||
| 110 | int full) | ||
| 111 | { | ||
| 112 | return pmdp_get_and_clear(mm, address, pmdp); | ||
| 113 | } | ||
| 114 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
| 115 | #endif | ||
| 116 | |||
| 106 | #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL | 117 | #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL |
| 107 | static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, | 118 | static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, |
| 108 | unsigned long address, pte_t *ptep, | 119 | unsigned long address, pte_t *ptep, |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 7e9c15cb93a9..6a37f1b2ed1e 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -1400,7 +1400,8 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, | |||
| 1400 | * pgtable_trans_huge_withdraw after finishing pmdp related | 1400 | * pgtable_trans_huge_withdraw after finishing pmdp related |
| 1401 | * operations. | 1401 | * operations. |
| 1402 | */ | 1402 | */ |
| 1403 | orig_pmd = pmdp_get_and_clear(tlb->mm, addr, pmd); | 1403 | orig_pmd = pmdp_get_and_clear_full(tlb->mm, addr, pmd, |
| 1404 | tlb->fullmm); | ||
| 1404 | tlb_remove_pmd_tlb_entry(tlb, pmd, addr); | 1405 | tlb_remove_pmd_tlb_entry(tlb, pmd, addr); |
| 1405 | pgtable = pgtable_trans_huge_withdraw(tlb->mm, pmd); | 1406 | pgtable = pgtable_trans_huge_withdraw(tlb->mm, pmd); |
| 1406 | if (is_huge_zero_pmd(orig_pmd)) { | 1407 | if (is_huge_zero_pmd(orig_pmd)) { |
