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

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/book3s64/hugetlb: Fix disabling hugetlb when fadump is active

Commit 8597538712eb ("powerpc/fadump: Do not use hugepages when fadump
is active") disabled hugetlb support when fadump is active by returning
early from hugetlbpage_init():arch/powerpc/mm/hugetlbpage.c and not
populating hpage_shift/HPAGE_SHIFT.

Later, commit 2354ad252b66 ("powerpc/mm: Update default hugetlb size
early") moved the allocation of hpage_shift/HPAGE_SHIFT to early boot,
which inadvertently re-enabled hugetlb support when fadump is active.

Fix this by implementing hugepages_supported() on powerpc. This ensures
that disabling hugetlb for the fadump kernel is independent of
hpage_shift/HPAGE_SHIFT.

Fixes: 2354ad252b66 ("powerpc/mm: Update default hugetlb size early")
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241217074640.1064510-1-sourabhjain@linux.ibm.com

authored by

Sourabh Jain and committed by
Madhavan Srinivasan
d629d7a8 9fa97126

+9
+9
arch/powerpc/include/asm/hugetlb.h
··· 15 15 16 16 extern bool hugetlb_disabled; 17 17 18 + static inline bool hugepages_supported(void) 19 + { 20 + if (hugetlb_disabled) 21 + return false; 22 + 23 + return HPAGE_SHIFT != 0; 24 + } 25 + #define hugepages_supported hugepages_supported 26 + 18 27 void __init hugetlbpage_init_defaultsize(void); 19 28 20 29 int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,