Skip to content

Commit 9ed2b46

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/mm: Drop redundant BUG_ON(!pgtable_alloc)
__create_pgd_mapping_locked() expects a page allocator used while mapping a virtual range. This page allocator function propagates down the call chain, while building intermediate levels in the page table. Passed page allocator is a necessary ingredient required to build the page table but its presence can be asserted just once in the very beginning rather than in all the down stream functions. This consolidates BUG_ON(!pgtable_alloc) checks just in a single place i.e __create_pgd_mapping_locked(). Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Andrew Morton <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Anshuman Khandual <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent d8c1d79 commit 9ed2b46

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/arm64/mm/mmu.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ static void alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr,
207207

208208
if (flags & NO_EXEC_MAPPINGS)
209209
pmdval |= PMD_TABLE_PXN;
210-
BUG_ON(!pgtable_alloc);
211210
pte_phys = pgtable_alloc(PAGE_SHIFT);
212211
__pmd_populate(pmdp, pte_phys, pmdval);
213212
pmd = READ_ONCE(*pmdp);
@@ -285,7 +284,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
285284

286285
if (flags & NO_EXEC_MAPPINGS)
287286
pudval |= PUD_TABLE_PXN;
288-
BUG_ON(!pgtable_alloc);
289287
pmd_phys = pgtable_alloc(PMD_SHIFT);
290288
__pud_populate(pudp, pmd_phys, pudval);
291289
pud = READ_ONCE(*pudp);
@@ -324,7 +322,6 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
324322

325323
if (flags & NO_EXEC_MAPPINGS)
326324
p4dval |= P4D_TABLE_PXN;
327-
BUG_ON(!pgtable_alloc);
328325
pud_phys = pgtable_alloc(PUD_SHIFT);
329326
__p4d_populate(p4dp, pud_phys, p4dval);
330327
p4d = READ_ONCE(*p4dp);
@@ -383,6 +380,7 @@ static void __create_pgd_mapping_locked(pgd_t *pgdir, phys_addr_t phys,
383380
phys &= PAGE_MASK;
384381
addr = virt & PAGE_MASK;
385382
end = PAGE_ALIGN(virt + size);
383+
BUG_ON(!pgtable_alloc);
386384

387385
do {
388386
next = pgd_addr_end(addr, end);

0 commit comments

Comments
 (0)