Remove _PAGE_SPLITTING from ppc64
Subsystems (6)
v2 cover Remove _PAGE_SPLITTING from ppc64
The changes are on top of what is posted at
http://mid.gmane.org/1429823043-157133-1-git-send-email-kirill.shutemov@linux.intel.com
git://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git thp/refcounting/v5
Changes from V1:
* Fold part of patch 3 to 1 and 2
* Drop patch 3.
* Make generic version of pmdp_splitting_flush_notify inline.
Aneesh Kumar K.V (2):
mm/thp: Use new functions to clear pmd on splitting and collapse powerpc/thp: Remove _PAGE_SPLITTING and related code
arch/powerpc/include/asm/kvm_book3s_64.h | 6 -- arch/powerpc/include/asm/pgtable-ppc64.h | 29 ++------ arch/powerpc/mm/hugepage-hash64.c | 3 - arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/pgtable_64.c | 111 ++++++++++++------------------- include/asm-generic/pgtable.h | 32 +++++++++ mm/gup.c | 2 +- mm/huge_memory.c | 9 +-- 8 files changed, 89 insertions(+), 105 deletions(-)
Signature · 1 line
2.1.4
PATCH v2 1/2 mm/thp: Use new functions to clear pmd on splitting and collapse
Some arch may require an explicit IPI before a THP PMD split or collapse. This enable us to use local_irq_disable to prevent a parallel THP PMD split or collapse.
--- include/asm-generic/pgtable.h | 32 ++++++++++++++++++++++++++++++++ mm/huge_memory.c | 9 +++++---- 2 files changed, 37 insertions(+), 4 deletions(-)
include/asm-generic/pgtable.h +32 -0
@@ -184,6 +184,38 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif +#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH_NOTIFY +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#define pmdp_splitting_flush_notify pmdp_clear_flush_notify +#else +static inline void pmdp_splitting_flush_notify (struct vm_area_struct *vma, +unsigned long address, +pmd_t *pmdp) +{ +BUILD_BUG (); +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#endif + +#ifndef __HAVE_ARCH_PMDP_COLLAPSE_FLUSH +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline pmd_t pmdp_collapse_flush (struct vm_area_struct *vma, +unsigned long address, +pmd_t *pmdp) +{ +return pmdp_clear_flush (vma, address, pmdp); +} +#else +static inline pmd_t pmdp_collapse_flush (struct vm_area_struct *vma, +unsigned long address, +pmd_t *pmdp) +{ +BUILD_BUG (); +return __pmd (0 ); +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#endif +#ifndef __HAVE_ARCH_PGTABLE_DEPOSITextern void pgtable_trans_huge_deposit (struct mm_struct *mm,pmd_t *pmdp,pgtable_t pgtable);
mm/huge_memory.c +5 -4
@@ -2187,7 +2187,7 @@ static void collapse_huge_page(struct mm_struct *mm,* huge and small TLB entries for the same virtual address * to avoid the risk of CPU bugs in that area. */ - _pmd =pmdp_clear_flush (vma, address, pmd); + _pmd =pmdp_collapse_flush (vma, address, pmd);spin_unlock (pmd_ptl);mmu_notifier_invalidate_range_end (mm, mmun_start, mmun_end);
@@ -2606,9 +2606,10 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, write =pmd_write (*pmd); young =pmd_young (*pmd); - -/* leave pmd empty until pte is filled */ -pmdp_clear_flush_notify (vma, haddr, pmd); +/* +* leave pmd empty until pte is filled. +*/ +pmdp_splitting_flush_notify (vma, haddr, pmd); pgtable =pgtable_trans_huge_withdraw (mm, pmd);pmd_populate (mm, &_pmd, pgtable);
Signature · 1 line
2.1.4
PATCH v2 2/2 powerpc/thp: Remove _PAGE_SPLITTING and related code
In reply to Aneesh Kumar K.VWith the new thp refcounting we don't need to mark the PMD splitting. Drop the code to handle this.
--- arch/powerpc/include/asm/kvm_book3s_64.h | 6 -- arch/powerpc/include/asm/pgtable-ppc64.h | 29 ++------ arch/powerpc/mm/hugepage-hash64.c | 3 - arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/pgtable_64.c | 111 ++++++++++++------------------- mm/gup.c | 2 +- 6 files changed, 52 insertions(+), 101 deletions(-)
arch/powerpc/include/asm/kvm_book3s_64.h +0 -6
@@ -298,12 +298,6 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing,cpu_relax ();continue ; } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -/* If hugepage and is trans splitting return None */ -if (unlikely (hugepage && -pmd_trans_splitting (pte_pmd (old_pte)))) -return __pte (0 ); -#endif /* If pte is not present return None */ if (unlikely (!(old_pte & _PAGE_PRESENT)))return __pte (0 );
arch/powerpc/include/asm/pgtable-ppc64.h +7 -22
@@ -361,11 +361,6 @@ void pgtable_cache_init(void);#endif /* __ASSEMBLY__ */ /* -* THP pages can't be special. So use the _PAGE_SPECIAL -*/ -#define _PAGE_SPLITTING _PAGE_SPECIAL - -/* * We need to differentiate between explicit huge page and THP huge * page, since THP huge page also need to track real subpage details */
@@ -375,8 +370,7 @@ void pgtable_cache_init(void);* set of bits not changed in pmd_modify. */ #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ - _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ - _PAGE_THP_HUGE) + _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_THP_HUGE)#ifndef __ASSEMBLY__/*
@@ -458,13 +452,6 @@ static inline int pmd_trans_huge(pmd_t pmd) return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE); } -static inline int pmd_trans_splitting (pmd_t pmd) -{ -if (pmd_trans_huge (pmd)) -return pmd_val (pmd) & _PAGE_SPLITTING; -return 0 ; -} -extern int has_transparent_hugepage (void );#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
@@ -517,12 +504,6 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)return pmd; } -static inline pmd_t pmd_mksplitting (pmd_t pmd) -{ -pmd_val (pmd) |= _PAGE_SPLITTING; -return pmd; -} -#define __HAVE_ARCH_PMD_SAMEstatic inline int pmd_same (pmd_t pmd_a,pmd_t pmd_b) {
@@ -577,8 +558,12 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,pmd_hugepage_update (mm, addr, pmdp, _PAGE_RW,0 ); } -#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH -extern void pmdp_splitting_flush (struct vm_area_struct *vma, +#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH_NOTIFY +extern void pmdp_splitting_flush_notify (struct vm_area_struct *vma, +unsigned long address,pmd_t *pmdp); + +#define __HAVE_ARCH_PMDP_COLLAPSE_FLUSH +extern pmd_t pmdp_collapse_flush (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp);#define __HAVE_ARCH_PGTABLE_DEPOSIT
arch/powerpc/mm/hugepage-hash64.c +0 -3
@@ -39,9 +39,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,/* If PMD busy, retry the access */ if (unlikely (old_pmd & _PAGE_BUSY))return 0 ; -/* If PMD is trans splitting retry the access */ -if (unlikely (old_pmd & _PAGE_SPLITTING)) -return 0 ;/* If PMD permissions don't match, take page fault */ if (unlikely (access & ~old_pmd))return 1 ;
arch/powerpc/mm/hugetlbpage.c +1 -1
@@ -1008,7 +1008,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift* hpte invalidate * */ -if (pmd_none (pmd) ||pmd_trans_splitting (pmd)) +if (pmd_none (pmd))return NULL ;if (pmd_huge (pmd) ||pmd_large (pmd)) {
arch/powerpc/mm/pgtable_64.c +43 -68
143 lines not on this page · raw message
mm/gup.c +1 -1
@@ -1215,7 +1215,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,pmd_t pmd =ACCESS_ONCE (*pmdp); next =pmd_addr_end (addr, end); -if (pmd_none (pmd) ||pmd_trans_splitting (pmd)) +if (pmd_none (pmd))return 0 ;if (unlikely (pmd_trans_huge (pmd) ||pmd_huge (pmd))) {
Signature · 1 line
2.1.4