hugetlb: harmonize hugetlb.h arch specific defines with pgtable.h
authorAlexandre Ghiti <>
Fri, 26 Oct 2018 22:07:59 +0000 (15:07 -0700)
committerLinus Torvalds <>
Fri, 26 Oct 2018 23:26:34 +0000 (16:26 -0700)
In order to reduce copy/paste of functions across architectures and then
make riscv hugetlb port (and future ports) simpler and smaller, this
patchset intends to factorize the numerous hugetlb primitives that are
defined across all the architectures.

Except for prepare_hugepage_range, this patchset moves the versions that
are just pass-through to standard pte primitives into
asm-generic/hugetlb.h by using the same #ifdef semantic that can be found
in asm-generic/pgtable.h, i.e.  __HAVE_ARCH_***.

s390 architecture has not been tackled in this serie since it does not use
asm-generic/hugetlb.h at all.

This patchset has been compiled on all addressed architectures with
success (except for parisc, but the problem does not come from this

This patch (of 11):

asm-generic/hugetlb.h proposes generic implementations of hugetlb related
functions: use __HAVE_ARCH_HUGE* defines in order to make arch specific
implementations of hugetlb functions consistent with pgtable.h scheme.

Signed-off-by: Alexandre Ghiti <>
Reviewed-by: Luiz Capitulino <>
Reviewed-by: Mike Kravetz <>
Acked-by: Catalin Marinas <> [arm64]
Cc: Russell King <>
Cc: Will Deacon <>
Cc: Tony Luck <>
Cc: Fenghua Yu <>
Cc: Ralf Baechle <>
Cc: Paul Burton <>
Cc: James Hogan <>
Cc: James E.J. Bottomley <>
Cc: Helge Deller <>
Cc: Benjamin Herrenschmidt <>
Cc: Paul Mackerras <>
Cc: Michael Ellerman <>
Cc: Yoshinori Sato <>
Cc: Rich Felker <>
Cc: David S. Miller <>
Cc: Thomas Gleixner <>
Cc: Ingo Molnar <>
Cc: H. Peter Anvin <>
Cc: Arnd Bergmann <>
Cc: Martin Schwidefsky <>
Cc: Heiko Carstens <>
Cc: Ingo Molnar <> [x86]
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

index e73f6856962461952287b244831395200cdc3853..3fcf14663dfa2385105106b93d676b0809c85029 100644 (file)
@@ -81,9 +81,9 @@ extern void huge_ptep_set_wrprotect(struct mm_struct *mm,
                                    unsigned long addr, pte_t *ptep);
 extern void huge_ptep_clear_flush(struct vm_area_struct *vma,
                                  unsigned long addr, pte_t *ptep);
 extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
                           pte_t *ptep, unsigned long sz);
-#define huge_pte_clear huge_pte_clear
 extern void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr,
                                 pte_t *ptep, pte_t pte, unsigned long sz);
 #define set_huge_swap_pte_at set_huge_swap_pte_at
index 9d0cde8ab716f6264e5e9c2398100dcb55f64010..3da7cff52360375b6c964f0c6be22f4689743992 100644 (file)
@@ -32,7 +32,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
        return pte_modify(pte, newprot);
-#ifndef huge_pte_clear
 static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
                    pte_t *ptep, unsigned long sz)