Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/hugetlb: define a generic fallback for is_hugepage_only_range()

There are multiple similar definitions for is_hugepage_only_range() on
various platforms. Lets just add it's generic fallback definition for
platforms that do not override. This help reduce code duplication.

Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: http://lkml.kernel.org/r/1588907271-11920-3-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Anshuman Khandual and committed by
Linus Torvalds
b0eae98c be51e3fd

+11 -56
-6
arch/arm/include/asm/hugetlb.h
··· 14 14 #include <asm/hugetlb-3level.h> 15 15 #include <asm-generic/hugetlb.h> 16 16 17 - static inline int is_hugepage_only_range(struct mm_struct *mm, 18 - unsigned long addr, unsigned long len) 19 - { 20 - return 0; 21 - } 22 - 23 17 static inline void arch_clear_hugepage_flags(struct page *page) 24 18 { 25 19 clear_bit(PG_dcache_clean, &page->flags);
-6
arch/arm64/include/asm/hugetlb.h
··· 17 17 extern bool arch_hugetlb_migration_supported(struct hstate *h); 18 18 #endif 19 19 20 - static inline int is_hugepage_only_range(struct mm_struct *mm, 21 - unsigned long addr, unsigned long len) 22 - { 23 - return 0; 24 - } 25 - 26 20 static inline void arch_clear_hugepage_flags(struct page *page) 27 21 { 28 22 clear_bit(PG_dcache_clean, &page->flags);
+1
arch/ia64/include/asm/hugetlb.h
··· 20 20 return (REGION_NUMBER(addr) == RGN_HPAGE || 21 21 REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE); 22 22 } 23 + #define is_hugepage_only_range is_hugepage_only_range 23 24 24 25 #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH 25 26 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
-7
arch/mips/include/asm/hugetlb.h
··· 11 11 12 12 #include <asm/page.h> 13 13 14 - static inline int is_hugepage_only_range(struct mm_struct *mm, 15 - unsigned long addr, 16 - unsigned long len) 17 - { 18 - return 0; 19 - } 20 - 21 14 #define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE 22 15 static inline int prepare_hugepage_range(struct file *file, 23 16 unsigned long addr,
-6
arch/parisc/include/asm/hugetlb.h
··· 12 12 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 13 13 pte_t *ptep); 14 14 15 - static inline int is_hugepage_only_range(struct mm_struct *mm, 16 - unsigned long addr, 17 - unsigned long len) { 18 - return 0; 19 - } 20 - 21 15 /* 22 16 * If the arch doesn't supply something else, assume that hugepage 23 17 * size aligned regions are ok without further preparation.
+1
arch/powerpc/include/asm/hugetlb.h
··· 30 30 return slice_is_hugepage_only_range(mm, addr, len); 31 31 return 0; 32 32 } 33 + #define is_hugepage_only_range is_hugepage_only_range 33 34 34 35 #define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE 35 36 void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
-6
arch/riscv/include/asm/hugetlb.h
··· 5 5 #include <asm-generic/hugetlb.h> 6 6 #include <asm/page.h> 7 7 8 - static inline int is_hugepage_only_range(struct mm_struct *mm, 9 - unsigned long addr, 10 - unsigned long len) { 11 - return 0; 12 - } 13 - 14 8 static inline void arch_clear_hugepage_flags(struct page *page) 15 9 { 16 10 }
-7
arch/s390/include/asm/hugetlb.h
··· 21 21 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, 22 22 unsigned long addr, pte_t *ptep); 23 23 24 - static inline bool is_hugepage_only_range(struct mm_struct *mm, 25 - unsigned long addr, 26 - unsigned long len) 27 - { 28 - return false; 29 - } 30 - 31 24 /* 32 25 * If the arch doesn't supply something else, assume that hugepage 33 26 * size aligned regions are ok without further preparation.
-6
arch/sh/include/asm/hugetlb.h
··· 5 5 #include <asm/cacheflush.h> 6 6 #include <asm/page.h> 7 7 8 - static inline int is_hugepage_only_range(struct mm_struct *mm, 9 - unsigned long addr, 10 - unsigned long len) { 11 - return 0; 12 - } 13 - 14 8 /* 15 9 * If the arch doesn't supply something else, assume that hugepage 16 10 * size aligned regions are ok without further preparation.
-6
arch/sparc/include/asm/hugetlb.h
··· 20 20 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 21 21 pte_t *ptep); 22 22 23 - static inline int is_hugepage_only_range(struct mm_struct *mm, 24 - unsigned long addr, 25 - unsigned long len) { 26 - return 0; 27 - } 28 - 29 23 #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH 30 24 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, 31 25 unsigned long addr, pte_t *ptep)
-6
arch/x86/include/asm/hugetlb.h
··· 7 7 8 8 #define hugepages_supported() boot_cpu_has(X86_FEATURE_PSE) 9 9 10 - static inline int is_hugepage_only_range(struct mm_struct *mm, 11 - unsigned long addr, 12 - unsigned long len) { 13 - return 0; 14 - } 15 - 16 10 static inline void arch_clear_hugepage_flags(struct page *page) 17 11 { 18 12 }
+9
include/linux/hugetlb.h
··· 591 591 592 592 #include <asm/hugetlb.h> 593 593 594 + #ifndef is_hugepage_only_range 595 + static inline int is_hugepage_only_range(struct mm_struct *mm, 596 + unsigned long addr, unsigned long len) 597 + { 598 + return 0; 599 + } 600 + #define is_hugepage_only_range is_hugepage_only_range 601 + #endif 602 + 594 603 #ifndef arch_make_huge_pte 595 604 static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, 596 605 struct page *page, int writable)