]> www.infradead.org Git - users/jedix/linux-maple.git/commit
riscv: mm: Pre-allocate vmemmap/direct map/kasan PGD entries
authorBjörn Töpel <bjorn@rivosinc.com>
Wed, 5 Jun 2024 11:40:45 +0000 (13:40 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 26 Jun 2024 15:42:39 +0000 (08:42 -0700)
commit66673099f734fd6512055fee353b5c81dafec216
tree9a7ce8a27f3a6e83febcfe02231813375a9bec4c
parente3ecf2fdc8f39a898f9e06481e935b460a097e10
riscv: mm: Pre-allocate vmemmap/direct map/kasan PGD entries

The RISC-V port copies the PGD table from init_mm/swapper_pg_dir to
all userland page tables, which means that if the PGD level table is
changed, other page tables has to be updated as well.

Instead of having the PGD changes ripple out to all tables, the
synchronization can be avoided by pre-allocating the PGD entries/pages
at boot, avoiding the synchronization all together.

This is currently done for the bpf/modules, and vmalloc PGD regions.
Extend this scheme for the PGD regions touched by memory hotplugging.

Prepare the RISC-V port for memory hotplug by pre-allocate
vmemmap/direct map/kasan entries at the PGD level. This will roughly
waste ~128 (plus 32 if KASAN is enabled) worth of 4K pages when memory
hotplugging is enabled in the kernel configuration.

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20240605114100.315918-3-bjorn@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/kasan.h
arch/riscv/mm/init.c