Skip to content

Commit f28b6ff

Browse files
kvaneeshtorvalds
authored andcommitted
powerpc/mm: use generic version of pmdp_clear_flush()
Also move the pmd_trans_huge check to generic code. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 15a25b2 commit f28b6ff

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

arch/powerpc/include/asm/pgtable-ppc64.h

-4
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,6 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma,
573573
extern pmd_t pmdp_get_and_clear(struct mm_struct *mm,
574574
unsigned long addr, pmd_t *pmdp);
575575

576-
#define __HAVE_ARCH_PMDP_CLEAR_FLUSH
577-
extern pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
578-
pmd_t *pmdp);
579-
580576
#define __HAVE_ARCH_PMDP_SET_WRPROTECT
581577
static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
582578
pmd_t *pmdp)

arch/powerpc/mm/pgtable_64.c

-11
Original file line numberDiff line numberDiff line change
@@ -554,17 +554,6 @@ unsigned long pmd_hugepage_update(struct mm_struct *mm, unsigned long addr,
554554
return old;
555555
}
556556

557-
pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
558-
pmd_t *pmdp)
559-
{
560-
pmd_t pmd;
561-
562-
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
563-
VM_BUG_ON(!pmd_trans_huge(*pmdp));
564-
pmd = pmdp_get_and_clear(vma->vm_mm, address, pmdp);
565-
return pmd;
566-
}
567-
568557
pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long address,
569558
pmd_t *pmdp)
570559
{

arch/s390/include/asm/pgtable.h

+8
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,14 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
15481548
}
15491549
}
15501550

1551+
static inline pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
1552+
unsigned long address,
1553+
pmd_t *pmdp)
1554+
{
1555+
return pmdp_get_and_clear(vma->vm_mm, address, pmdp);
1556+
}
1557+
#define pmdp_collapse_flush pmdp_collapse_flush
1558+
15511559
#define pfn_pmd(pfn, pgprot) mk_pmd_phys(__pa((pfn) << PAGE_SHIFT), (pgprot))
15521560
#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
15531561

include/asm-generic/pgtable.h

+2-7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,8 @@ extern void pmdp_splitting_flush(struct vm_area_struct *vma,
191191

192192
#ifndef pmdp_collapse_flush
193193
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
194-
static inline pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
195-
unsigned long address,
196-
pmd_t *pmdp)
197-
{
198-
return pmdp_clear_flush(vma, address, pmdp);
199-
}
200-
#define pmdp_collapse_flush pmdp_collapse_flush
194+
extern pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
195+
unsigned long address, pmd_t *pmdp);
201196
#else
202197
static inline pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
203198
unsigned long address,

mm/pgtable-generic.c

+17
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
126126
{
127127
pmd_t pmd;
128128
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
129+
VM_BUG_ON(!pmd_trans_huge(*pmdp));
129130
pmd = pmdp_get_and_clear(vma->vm_mm, address, pmdp);
130131
flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
131132
return pmd;
@@ -198,3 +199,19 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
198199
}
199200
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
200201
#endif
202+
203+
#ifndef pmdp_collapse_flush
204+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
205+
pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long address,
206+
pmd_t *pmdp)
207+
{
208+
pmd_t pmd;
209+
210+
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
211+
VM_BUG_ON(pmd_trans_huge(*pmdp));
212+
pmd = pmdp_get_and_clear(vma->vm_mm, address, pmdp);
213+
flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
214+
return pmd;
215+
}
216+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
217+
#endif

0 commit comments

Comments
 (0)