powerpc/mm: define get_slice_psize() all the time
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 25 Apr 2019 14:29:35 +0000 (14:29 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 May 2019 15:20:23 +0000 (01:20 +1000)
get_slice_psize() can be defined regardless of CONFIG_PPC_MM_SLICES
to avoid ifdefs

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/slice.h
arch/powerpc/mm/hugetlbpage.c

index be8af667098fc1c81cc7349f2bb3bf7bece68575..c6f466f4c24100b82502d8f6934d999b0053d783 100644 (file)
@@ -36,6 +36,11 @@ void slice_setup_new_exec(void);
 
 static inline void slice_init_new_context_exec(struct mm_struct *mm) {}
 
+static inline unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
+{
+       return 0;
+}
+
 #endif /* CONFIG_PPC_MM_SLICES */
 
 #endif /* __ASSEMBLY__ */
index 9e732bb2c84aee21e20e41d7e7e8bf1f4f3f4fae..5f67e7a4d1cc685f1106de13cd60bf446d79d581 100644 (file)
@@ -578,14 +578,12 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 
 unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
 {
-#ifdef CONFIG_PPC_MM_SLICES
        /* With radix we don't use slice, so derive it from vma*/
-       if (!radix_enabled()) {
+       if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) {
                unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
 
                return 1UL << mmu_psize_to_shift(psize);
        }
-#endif
        return vma_kernel_pagesize(vma);
 }