mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
arm64/hugetlb: Define __hugetlb_valid_size()
arch_hugetlb_valid_size() can be just factored out to create another helper to be used in arch_hugetlb_migration_supported() as well. This just defines __hugetlb_valid_size() for that purpose. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Link: https://lore.kernel.org/r/1645073557-6150-1-git-send-email-anshuman.khandual@arm.com Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
ee017ee353
commit
a8a733b201
@ -56,24 +56,33 @@ void __init arm64_hugetlb_cma_reserve(void)
|
||||
}
|
||||
#endif /* CONFIG_CMA */
|
||||
|
||||
static bool __hugetlb_valid_size(unsigned long size)
|
||||
{
|
||||
switch (size) {
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
case PUD_SIZE:
|
||||
return pud_sect_supported();
|
||||
#endif
|
||||
case CONT_PMD_SIZE:
|
||||
case PMD_SIZE:
|
||||
case CONT_PTE_SIZE:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
|
||||
bool arch_hugetlb_migration_supported(struct hstate *h)
|
||||
{
|
||||
size_t pagesize = huge_page_size(h);
|
||||
|
||||
switch (pagesize) {
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
case PUD_SIZE:
|
||||
return pud_sect_supported();
|
||||
#endif
|
||||
case PMD_SIZE:
|
||||
case CONT_PMD_SIZE:
|
||||
case CONT_PTE_SIZE:
|
||||
return true;
|
||||
}
|
||||
pr_warn("%s: unrecognized huge page size 0x%lx\n",
|
||||
if (!__hugetlb_valid_size(pagesize)) {
|
||||
pr_warn("%s: unrecognized huge page size 0x%lx\n",
|
||||
__func__, pagesize);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -506,16 +515,5 @@ arch_initcall(hugetlbpage_init);
|
||||
|
||||
bool __init arch_hugetlb_valid_size(unsigned long size)
|
||||
{
|
||||
switch (size) {
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
case PUD_SIZE:
|
||||
return pud_sect_supported();
|
||||
#endif
|
||||
case CONT_PMD_SIZE:
|
||||
case PMD_SIZE:
|
||||
case CONT_PTE_SIZE:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return __hugetlb_valid_size(size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user