Skip to content

Commit b3697c0

Browse files
aagittorvalds
authored andcommitted
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>
1 parent 7e3d0eb commit b3697c0

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

include/asm-generic/pgtable.h

+3-11
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
8787
pmd_clear(mm, address, pmdp);
8888
return pmd;
8989
})
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-
}
9890
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
9991
#endif
10092

@@ -163,9 +155,9 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
163155
#endif
164156

165157
#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);
169161
#endif
170162

171163
#ifndef __HAVE_ARCH_PTE_SAME

mm/pgtable-generic.c

+4-7
Original file line numberDiff line numberDiff line change
@@ -92,32 +92,29 @@ pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address,
9292
#endif
9393

9494
#ifndef __HAVE_ARCH_PMDP_CLEAR_FLUSH
95+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
9596
pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
9697
pmd_t *pmdp)
9798
{
9899
pmd_t pmd;
99-
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
100-
BUG();
101-
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
102100
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
103101
pmd = pmdp_get_and_clear(vma->vm_mm, address, pmdp);
104102
flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
105103
return pmd;
106104
}
105+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
107106
#endif
108107

109108
#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH
109+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
110110
pmd_t pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
111111
pmd_t *pmdp)
112112
{
113-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
114113
pmd_t pmd = pmd_mksplitting(*pmdp);
115114
VM_BUG_ON(address & ~HPAGE_PMD_MASK);
116115
set_pmd_at(vma->vm_mm, address, pmdp, pmd);
117116
/* tlb flush only to serialize against gup-fast */
118117
flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
119-
#else /* CONFIG_TRANSPARENT_HUGEPAGE */
120-
BUG();
121-
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
122118
}
119+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
123120
#endif

0 commit comments

Comments
 (0)