pud = pud_alloc(mm, p4d, addr); if (!pud) return NULL; if (!mm_pmd_folded(mm) && sz >= PUD_SIZE) return (pte_t *)pud;
pmd = pmd_alloc(mm, pud, addr); if (!pmd) return NULL;
if (sz >= PMD_SIZE) { /* On 8xx, all hugepages are handled as contiguous PTEs */ if (IS_ENABLED(CONFIG_PPC_8xx)) { int i;
for (i = 0; i < sz / PMD_SIZE; i++) { if (!pte_alloc_huge(mm, pmd + i, addr)) return NULL;
}
} return (pte_t *)pmd;
}
return pte_alloc_huge(mm, pmd, addr);
}
#ifdef CONFIG_PPC_BOOK3S_64 /* * Tracks gpages after the device tree is scanned and before the * huge_boot_pages list is ready on pseries.
*/ #define MAX_NUMBER_GPAGES 1024
__initdata static u64 gpage_freearray[MAX_NUMBER_GPAGES];
__initdata staticunsigned nr_gpages;
/* * Build list of addresses of gigantic pages. This function is used in early * boot before the buddy allocator is setup.
*/ void __init pseries_add_gpage(u64 addr, u64 page_size, unsignedlong number_of_pages)
{ if (!addr) return; while (number_of_pages > 0) {
gpage_freearray[nr_gpages] = addr;
nr_gpages++;
number_of_pages--;
addr += page_size;
}
}
bool __init arch_hugetlb_valid_size(unsignedlong size)
{ int shift = __ffs(size); int mmu_psize;
/* Check that it is a page size supported by the hardware and
* that it fits within pagetable and slice limits. */ if (size <= PAGE_SIZE || !is_power_of_2(size)) returnfalse;
mmu_psize = check_and_get_huge_psize(shift); if (mmu_psize < 0) returnfalse;
BUG_ON(mmu_psize_defs[mmu_psize].shift != shift);
returntrue;
}
staticint __init add_huge_page_size(unsignedlonglong size)
{ int shift = __ffs(size);
if (!arch_hugetlb_valid_size((unsignedlong)size)) return -EINVAL;
if (add_huge_page_size(1ULL << shift) < 0) continue;
configured = true;
}
if (!configured)
pr_info("Failed to initialize. Disabling HugeTLB");
return 0;
}
arch_initcall(hugetlbpage_init);
void __init gigantic_hugetlb_cma_reserve(void)
{ unsignedlong order = 0;
if (radix_enabled())
order = PUD_SHIFT - PAGE_SHIFT; elseif (!firmware_has_feature(FW_FEATURE_LPAR) && mmu_psize_defs[MMU_PAGE_16G].shift) /* * For pseries we do use ibm,expected#pages for reserving 16G pages.
*/
order = mmu_psize_to_shift(MMU_PAGE_16G) - PAGE_SHIFT;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.