Commit 21613cfa authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/32: Reuse orphaned memblocks in kasan_init_shadow_page_tables()

If concurrent PMD population has happened, re-use orphaned memblocks.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b29ffffb9206dc14541fa420c17604240728041b.1579024426.git.christophe.leroy@c-s.fr
parent 509cd3f2
...@@ -34,16 +34,16 @@ static int __init kasan_init_shadow_page_tables(unsigned long k_start, unsigned ...@@ -34,16 +34,16 @@ static int __init kasan_init_shadow_page_tables(unsigned long k_start, unsigned
{ {
pmd_t *pmd; pmd_t *pmd;
unsigned long k_cur, k_next; unsigned long k_cur, k_next;
pte_t *new = NULL;
pmd = pmd_offset(pud_offset(pgd_offset_k(k_start), k_start), k_start); pmd = pmd_offset(pud_offset(pgd_offset_k(k_start), k_start), k_start);
for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd++) { for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd++) {
pte_t *new;
k_next = pgd_addr_end(k_cur, k_end); k_next = pgd_addr_end(k_cur, k_end);
if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte) if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte)
continue; continue;
if (!new)
new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE); new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE);
if (!new) if (!new)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment