static pmd_t *__init get_pmd(pgd_t pgtables[], unsigned long va) { pud_t *pud = pud_offset(&pgtables[pgd_index(va)], va); if (pud_none(*pud)) assign_pmd(pud, alloc_pmd()); return pmd_offset(pud, va); }
/* * paging_init() sets up the page tables - note that all of lowmem is * already mapped by head.S. */ void __init paging_init(void) { #ifdef __tilegx__ pud_t *pud; #endif pgd_t *pgd_base = swapper_pg_dir; kernel_physical_mapping_init(pgd_base); /* Fixed mappings, only the page table structure has to be created. */ page_table_range_init(fix_to_virt(__end_of_fixed_addresses - 1), FIXADDR_TOP, pgd_base); #ifdef CONFIG_HIGHMEM permanent_kmaps_init(pgd_base); #endif #ifdef __tilegx__ /* * Since GX allocates just one pmd_t array worth of vmalloc space, * we go ahead and allocate it statically here, then share it * globally. As a result we don't have to worry about any task * changing init_mm once we get up and running, and there's no * need for e.g. vmalloc_sync_all(). */ BUILD_BUG_ON(pgd_index(VMALLOC_START) != pgd_index(VMALLOC_END - 1)); pud = pud_offset(pgd_base + pgd_index(VMALLOC_START), VMALLOC_START); assign_pmd(pud, alloc_pmd()); #endif }