Commit b3697c0255d9d73eaaa4deb4512e3f0ff97b3b71

Authored by Andrea Arcangeli
Committed by Linus Torvalds
1 parent 7e3d0eb0b0

fix non-x86 build failure in pmdp_get_and_clear

pmdp_get_and_clear/pmdp_clear_flush/pmdp_splitting_flush were trapped as
BUG() and they were defined only to diminish the risk of build issues on
not-x86 archs and to be consistent with the generic pte methods previously
defined in include/asm-generic/pgtable.h.

But they are causing more trouble than they were supposed to solve, so
it's simpler not to define them when THP is off.

This is also correcting the export of pmdp_splitting_flush which is
currently unused (x86 isn't using the generic implementation in
mm/pgtable-generic.c and no other arch needs that [yet]).

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Sam Ravnborg <sam@ravnborg.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 7 additions and 18 deletions Side-by-side Diff

include/asm-generic/pgtable.h
... ... @@ -87,14 +87,6 @@
87 87 pmd_clear(mm, address, pmdp);
88 88 return pmd;
89 89 })
90   -#else /* CONFIG_TRANSPARENT_HUGEPAGE */
91   -static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
92   - unsigned long address,
93   - pmd_t *pmdp)
94   -{
95   - BUG();
96   - return __pmd(0);
97   -}
98 90 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
99 91 #endif
100 92  
... ... @@ -163,9 +155,9 @@
163 155 #endif
164 156  
165 157 #ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH
166   -extern pmd_t pmdp_clear_flush(struct vm_area_struct *vma,
167   - unsigned long address,
168   - pmd_t *pmdp);
  158 +extern pmd_t pmdp_splitting_flush(struct vm_area_struct *vma,
  159 + unsigned long address,
  160 + pmd_t *pmdp);
169 161 #endif
170 162  
171 163 #ifndef __HAVE_ARCH_PTE_SAME
mm/pgtable-generic.c
... ... @@ -92,33 +92,30 @@
92 92 #endif
93 93  
94 94 #ifndef __HAVE_ARCH_PMDP_CLEAR_FLUSH
  95 +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
95 96 pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
96 97 pmd_t *pmdp)
97 98 {
98 99 pmd_t pmd;
99   -#ifndef CONFIG_TRANSPARENT_HUGEPAGE
100   - BUG();
101   -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
102 100 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
103 101 pmd = pmdp_get_and_clear(vma->vm_mm, address, pmdp);
104 102 flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
105 103 return pmd;
106 104 }
  105 +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
107 106 #endif
108 107  
109 108 #ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH
  109 +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
110 110 pmd_t pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
111 111 pmd_t *pmdp)
112 112 {
113   -#ifdef CONFIG_TRANSPARENT_HUGEPAGE
114 113 pmd_t pmd = pmd_mksplitting(*pmdp);
115 114 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
116 115 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
117 116 /* tlb flush only to serialize against gup-fast */
118 117 flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
119   -#else /* CONFIG_TRANSPARENT_HUGEPAGE */
120   - BUG();
121   -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
122 118 }
  119 +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
123 120 #endif