Skip to content

Commit fc325b1

Browse files
Alexandre Ghitipalmer-dabbelt
authored andcommitted
riscv: Fix build error if !CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
The new riscv specific arch_hugetlb_migration_supported() must be guarded with a #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION to avoid the following build error: In file included from include/linux/hugetlb.h:851, from kernel/fork.c:52: >> arch/riscv/include/asm/hugetlb.h:15:42: error: static declaration of 'arch_hugetlb_migration_supported' follows non-static declaration 15 | #define arch_hugetlb_migration_supported arch_hugetlb_migration_supported | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/hugetlb.h:916:20: note: in expansion of macro 'arch_hugetlb_migration_supported' 916 | static inline bool arch_hugetlb_migration_supported(struct hstate *h) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/include/asm/hugetlb.h:14:6: note: previous declaration of 'arch_hugetlb_migration_supported' with type 'bool(struct hstate *)' {aka '_Bool(struct hstate *)'} 14 | bool arch_hugetlb_migration_supported(struct hstate *h); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202402110258.CV51JlEI-lkp@intel.com/ Fixes: ce68c03 ("riscv: Fix arch_hugetlb_migration_supported() for NAPOT") Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Link: https://lore.kernel.org/r/20240211083640.756583-1-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent c21f014 commit fc325b1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

arch/riscv/include/asm/hugetlb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ static inline void arch_clear_hugepage_flags(struct page *page)
1111
}
1212
#define arch_clear_hugepage_flags arch_clear_hugepage_flags
1313

14+
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
1415
bool arch_hugetlb_migration_supported(struct hstate *h);
1516
#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
17+
#endif
1618

1719
#ifdef CONFIG_RISCV_ISA_SVNAPOT
1820
#define __HAVE_ARCH_HUGE_PTE_CLEAR

arch/riscv/mm/hugetlbpage.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,12 @@ bool __init arch_hugetlb_valid_size(unsigned long size)
426426
return __hugetlb_valid_size(size);
427427
}
428428

429+
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
429430
bool arch_hugetlb_migration_supported(struct hstate *h)
430431
{
431432
return __hugetlb_valid_size(huge_page_size(h));
432433
}
434+
#endif
433435

434436
#ifdef CONFIG_CONTIG_ALLOC
435437
static __init int gigantic_pages_init(void)

0 commit comments

Comments
 (0)