On 05/09/2020 03:52 AM, Mike Kravetz wrote:
> On 5/7/20 8:07 PM, Anshuman Khandual wrote:
>> 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.
>>
>> Cc: Russell King <li...@armlinux.org.uk>
>> Cc: Catalin Marinas <catalin.mari...@arm.com>
>> Cc: Will Deacon <w...@kernel.org>
>> Cc: Tony Luck <tony.l...@intel.com>
>> Cc: Fenghua Yu <fenghua...@intel.com>
>> Cc: Thomas Bogendoerfer <tsbog...@alpha.franken.de>
>> Cc: "James E.J. Bottomley" <james.bottom...@hansenpartnership.com>
>> Cc: Helge Deller <del...@gmx.de>
>> Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
>> Cc: Paul Mackerras <pau...@samba.org>
>> Cc: Michael Ellerman <m...@ellerman.id.au>
>> Cc: Paul Walmsley <paul.walms...@sifive.com>
>> Cc: Palmer Dabbelt <pal...@dabbelt.com>
>> Cc: Heiko Carstens <heiko.carst...@de.ibm.com>
>> Cc: Vasily Gorbik <g...@linux.ibm.com>
>> Cc: Christian Borntraeger <borntrae...@de.ibm.com>
>> Cc: Yoshinori Sato <ys...@users.sourceforge.jp>
>> Cc: Rich Felker <dal...@libc.org>
>> Cc: "David S. Miller" <da...@davemloft.net>
>> Cc: Thomas Gleixner <t...@linutronix.de>
>> Cc: Ingo Molnar <mi...@redhat.com>
>> Cc: Borislav Petkov <b...@alien8.de>
>> Cc: "H. Peter Anvin" <h...@zytor.com>
>> Cc: Mike Kravetz <mike.krav...@oracle.com>
>> Cc: Andrew Morton <a...@linux-foundation.org>
>> Cc: x...@kernel.org
>> Cc: linux-arm-ker...@lists.infradead.org
>> Cc: linux-i...@vger.kernel.org
>> Cc: linux-m...@vger.kernel.org
>> Cc: linux-par...@vger.kernel.org
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: linux-ri...@lists.infradead.org
>> Cc: linux-s...@vger.kernel.org
>> Cc: linux...@vger.kernel.org
>> Cc: sparcli...@vger.kernel.org
>> Cc: linux...@kvack.org
>> Cc: linux-a...@vger.kernel.org
>> Cc: linux-ker...@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khand...@arm.com>
>> ---
>> arch/arm/include/asm/hugetlb.h | 6 ------
>> arch/arm64/include/asm/hugetlb.h | 6 ------
>> arch/ia64/include/asm/hugetlb.h | 1 +
>> arch/mips/include/asm/hugetlb.h | 7 -------
>> arch/parisc/include/asm/hugetlb.h | 6 ------
>> arch/powerpc/include/asm/hugetlb.h | 1 +
>> arch/riscv/include/asm/hugetlb.h | 6 ------
>> arch/s390/include/asm/hugetlb.h | 7 -------
>> arch/sh/include/asm/hugetlb.h | 6 ------
>> arch/sparc/include/asm/hugetlb.h | 6 ------
>> arch/x86/include/asm/hugetlb.h | 6 ------
>> include/linux/hugetlb.h | 9 +++++++++
>> 12 files changed, 11 insertions(+), 56 deletions(-)
>>
> <snip>
>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index 43a1cef8f0f1..c01c0c6f7fd4 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
>> @@ -591,6 +591,15 @@ static inline unsigned int blocks_per_huge_page(struct
>> hstate *h)
>>
>> #include <asm/hugetlb.h>
>>
>> +#ifndef is_hugepage_only_range
>> +static inline int is_hugepage_only_range(struct mm_struct *mm,
>> + unsigned long addr, unsigned long len)
>> +{
>> + return 0;
>> +}
>> +#define is_hugepage_only_range is_hugepage_only_range
>> +#endif
>> +
>> #ifndef arch_make_huge_pte
>> static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct
>> *vma,
>> struct page *page, int writable)
>>
>
> Did you try building without CONFIG_HUGETLB_PAGE defined? I'm guessing
Yes I did for multiple platforms (s390, arm64, ia64, x86, powerpc etc).
> that you need a stub for is_hugepage_only_range(). Or, perhaps add this
> to asm-generic/hugetlb.h?
>
There is already a stub (include/linux/hugetlb.h) when !CONFIG_HUGETLB_PAGE.