summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark-PK Tsai <mark-pk.tsai@mediatek.com>2023-10-19 15:38:16 +0200
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-12-05 12:42:15 +0100
commit89320c9785e8429155f8dfa44a183b509866e852 (patch)
treed3fb5006040aeebdde872ace6c4739faf8058f25
parentARM: 9328/1: mm: try VMA lock-based page fault handling first (diff)
downloadlinux-89320c9785e8429155f8dfa44a183b509866e852.tar.xz
linux-89320c9785e8429155f8dfa44a183b509866e852.zip
ARM: 9329/1: kasan: Use memblock_alloc_try_nid_raw for shadow page
kasan_pte_populate fill KASAN_SHADOW_INIT in the newly allocated shadow page, so it's unnecessary to use memblock_alloc_try_nid, which always zero the new allocated memory. Use memblock_alloc_try_nid_raw instead of memblock_alloc_try_nid like arm64 does which can make kasan init faster. Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/mm/kasan_init.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c
index 24d71b5db62d..111d4f703136 100644
--- a/arch/arm/mm/kasan_init.c
+++ b/arch/arm/mm/kasan_init.c
@@ -28,6 +28,12 @@ static pgd_t tmp_pgd_table[PTRS_PER_PGD] __initdata __aligned(PGD_SIZE);
pmd_t tmp_pmd_table[PTRS_PER_PMD] __page_aligned_bss;
+static __init void *kasan_alloc_block_raw(size_t size)
+{
+ return memblock_alloc_try_nid_raw(size, size, __pa(MAX_DMA_ADDRESS),
+ MEMBLOCK_ALLOC_NOLEAKTRACE, NUMA_NO_NODE);
+}
+
static __init void *kasan_alloc_block(size_t size)
{
return memblock_alloc_try_nid(size, size, __pa(MAX_DMA_ADDRESS),
@@ -50,7 +56,7 @@ static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,
if (!pte_none(READ_ONCE(*ptep)))
continue;
- p = kasan_alloc_block(PAGE_SIZE);
+ p = kasan_alloc_block_raw(PAGE_SIZE);
if (!p) {
panic("%s failed to allocate shadow page for address 0x%lx\n",
__func__, addr);