Skip to content

Commit

Permalink
hugetlb: introduce generic version of hugetlb_free_pgd_range
Browse files Browse the repository at this point in the history
arm, arm64, mips, parisc, sh, x86 architectures use the same version of
hugetlb_free_pgd_range, so move this generic implementation into
asm-generic/hugetlb.h.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Alexandre Ghiti <[email protected]>
Reviewed-by: Luiz Capitulino <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Tested-by: Helge Deller <[email protected]>			[parisc]
Acked-by: Catalin Marinas <[email protected]>	[arm64]
Acked-by: Paul Burton <[email protected]>		[MIPS]
Acked-by: Ingo Molnar <[email protected]>		[x86]
Cc: Arnd Bergmann <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: Russell King <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
AlexGhiti authored and torvalds committed Oct 26, 2018
1 parent d018498 commit 1e5f50f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 62 deletions.
9 changes: 0 additions & 9 deletions arch/arm/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@

#include <asm/hugetlb-3level.h>

static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}


static inline int is_hugepage_only_range(struct mm_struct *mm,
unsigned long addr, unsigned long len)
{
Expand Down
10 changes: 0 additions & 10 deletions arch/arm64/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep)
return READ_ONCE(*ptep);
}



static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}

static inline int is_hugepage_only_range(struct mm_struct *mm,
unsigned long addr, unsigned long len)
{
Expand Down
5 changes: 3 additions & 2 deletions arch/ia64/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#define _ASM_IA64_HUGETLB_H

#include <asm/page.h>
#include <asm-generic/hugetlb.h>


#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE
void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
unsigned long end, unsigned long floor,
unsigned long ceiling);
Expand Down Expand Up @@ -70,4 +69,6 @@ static inline void arch_clear_hugepage_flags(struct page *page)
{
}

#include <asm-generic/hugetlb.h>

#endif /* _ASM_IA64_HUGETLB_H */
13 changes: 2 additions & 11 deletions arch/mips/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#define __ASM_HUGETLB_H

#include <asm/page.h>
#include <asm-generic/hugetlb.h>


static inline int is_hugepage_only_range(struct mm_struct *mm,
unsigned long addr,
Expand All @@ -38,15 +36,6 @@ static inline int prepare_hugepage_range(struct file *file,
return 0;
}

static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr,
unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}

static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{
Expand Down Expand Up @@ -114,4 +103,6 @@ static inline void arch_clear_hugepage_flags(struct page *page)
{
}

#include <asm-generic/hugetlb.h>

#endif /* __ASM_HUGETLB_H */
12 changes: 2 additions & 10 deletions arch/parisc/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#define _ASM_PARISC64_HUGETLB_H

#include <asm/page.h>
#include <asm-generic/hugetlb.h>


void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte);
Expand Down Expand Up @@ -32,14 +30,6 @@ static inline int prepare_hugepage_range(struct file *file,
return 0;
}

static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}

static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep)
{
Expand Down Expand Up @@ -71,4 +61,6 @@ static inline void arch_clear_hugepage_flags(struct page *page)
{
}

#include <asm-generic/hugetlb.h>

#endif /* _ASM_PARISC64_HUGETLB_H */
4 changes: 3 additions & 1 deletion arch/powerpc/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#ifdef CONFIG_HUGETLB_PAGE
#include <asm/page.h>
#include <asm-generic/hugetlb.h>

extern struct kmem_cache *hugepte_cache;

Expand Down Expand Up @@ -110,6 +109,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma,
void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
#endif

#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE
void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
unsigned long end, unsigned long floor,
unsigned long ceiling);
Expand Down Expand Up @@ -176,6 +176,8 @@ static inline void arch_clear_hugepage_flags(struct page *page)
{
}

#include <asm-generic/hugetlb.h>

#else /* ! CONFIG_HUGETLB_PAGE */
static inline void flush_hugetlb_page(struct vm_area_struct *vma,
unsigned long vmaddr)
Expand Down
12 changes: 2 additions & 10 deletions arch/sh/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include <asm/cacheflush.h>
#include <asm/page.h>
#include <asm-generic/hugetlb.h>


static inline int is_hugepage_only_range(struct mm_struct *mm,
unsigned long addr,
Expand All @@ -27,14 +25,6 @@ static inline int prepare_hugepage_range(struct file *file,
return 0;
}

static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}

static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{
Expand Down Expand Up @@ -85,4 +75,6 @@ static inline void arch_clear_hugepage_flags(struct page *page)
clear_bit(PG_dcache_clean, &page->flags);
}

#include <asm-generic/hugetlb.h>

#endif /* _ASM_SH_HUGETLB_H */
4 changes: 3 additions & 1 deletion arch/sparc/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#define _ASM_SPARC64_HUGETLB_H

#include <asm/page.h>
#include <asm-generic/hugetlb.h>

#ifdef CONFIG_HUGETLB_PAGE
struct pud_huge_patch_entry {
Expand Down Expand Up @@ -84,8 +83,11 @@ static inline void arch_clear_hugepage_flags(struct page *page)
{
}

#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE
void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
unsigned long end, unsigned long floor,
unsigned long ceiling);

#include <asm-generic/hugetlb.h>

#endif /* _ASM_SPARC64_HUGETLB_H */
8 changes: 0 additions & 8 deletions arch/x86/include/asm/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ static inline int prepare_hugepage_range(struct file *file,
return 0;
}

static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}

static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{
Expand Down
11 changes: 11 additions & 0 deletions include/asm-generic/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,15 @@ static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
}
#endif

#ifndef __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE
static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor, unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}


#endif

#endif /* _ASM_GENERIC_HUGETLB_H */

0 comments on commit 1e5f50f

Please sign in to comment.