Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / riscv / mm / hugetlbpage.c
blob932dadfdca544e4f08c130ee921c0954f1694643
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/hugetlb.h>
3 #include <linux/err.h>
5 int pud_huge(pud_t pud)
7 return pud_leaf(pud);
10 int pmd_huge(pmd_t pmd)
12 return pmd_leaf(pmd);
15 bool __init arch_hugetlb_valid_size(unsigned long size)
17 if (size == HPAGE_SIZE)
18 return true;
19 else if (IS_ENABLED(CONFIG_64BIT) && size == PUD_SIZE)
20 return true;
21 else
22 return false;
25 #ifdef CONFIG_CONTIG_ALLOC
26 static __init int gigantic_pages_init(void)
28 /* With CONTIG_ALLOC, we can allocate gigantic pages at runtime */
29 if (IS_ENABLED(CONFIG_64BIT))
30 hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
31 return 0;
33 arch_initcall(gigantic_pages_init);
34 #endif