[PATCH] arm64/hugetlb: fix hugetlb initialization
From: Mike Kravetz
Date: Mon Apr 20 2020 - 13:41:18 EST
When calling hugetlb_add_hstate() to initialize a new hugetlb size,
be sure to use correct huge pages size order.
Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
---
arch/arm64/mm/hugetlbpage.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 9ca840527296..a02411a1f19a 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -453,11 +453,11 @@ void huge_ptep_clear_flush(struct vm_area_struct *vma,
static int __init hugetlbpage_init(void)
{
#ifdef CONFIG_ARM64_4K_PAGES
- hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
+ hugetlb_add_hstate(ilog2(PUD_SIZE) - PAGE_SHIFT);
#endif
- hugetlb_add_hstate(CONT_PMD_SHIFT - PAGE_SHIFT);
- hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
- hugetlb_add_hstate(CONT_PTE_SHIFT - PAGE_SHIFT);
+ hugetlb_add_hstate(ilog2(CONT_PMD_SIZE) - PAGE_SHIFT);
+ hugetlb_add_hstate(ilog2(PMD_SIZE) - PAGE_SHIFT);
+ hugetlb_add_hstate(ilog2(CONT_PTE_SIZE) - PAGE_SHIFT);
return 0;
}
--
2.25.2