linux/arch/riscv
Björn Töpel 7d3332be01
riscv: mm: Pre-allocate PGD entries for vmalloc/modules area
The RISC-V port requires that kernel PGD entries are to be
synchronized between MMs. This is done via the vmalloc_fault()
function, that simply copies the PGD entries from init_mm to the
faulting one.

Historically, faulting in PGD entries have been a source for both bugs
[1], and poor performance.

One way to get rid of vmalloc faults is by pre-allocating the PGD
entries. Pre-allocating the entries potientially wastes 64 * 4K (65 on
SV39). The pre-allocation function is pulled from Jörg Rödel's x86
work, with the addition of 3-level page tables (PMD allocations).

The pmd_alloc() function needs the ptlock cache to be initialized
(when split page locks is enabled), so the pre-allocation is done in a
RISC-V specific pgtable_cache_init() implementation.

Pre-allocate the kernel PGD entries for the vmalloc/modules area, but
only for 64b platforms.

Link: https://lore.kernel.org/lkml/20200508144043.13893-1-joro@8bytes.org/ # [1]
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20230531093817.665799-1-bjorn@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-06-19 17:58:01 -07:00
..
boot RISC-V Patches for the 6.4 Merge Window, Part 1 2023-04-28 16:55:39 -07:00
configs RISC-V: Enable ACPI in defconfig 2023-06-01 08:45:14 -07:00
errata RISC-V: fix sifive and thead section mismatches in errata 2023-04-29 13:18:19 -07:00
include Merge patch series "RISC-V: Export Zba, Zbb to usermode via hwprobe" 2023-06-19 14:34:40 -07:00
kernel Merge patch series "RISC-V: Export Zba, Zbb to usermode via hwprobe" 2023-06-19 14:34:40 -07:00
kvm riscv: Add prctl controls for userspace vector management 2023-06-08 07:16:53 -07:00
lib riscv: Allow to downgrade paging mode from the command line 2023-04-26 07:30:52 -07:00
mm riscv: mm: Pre-allocate PGD entries for vmalloc/modules area 2023-06-19 17:58:01 -07:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-03-09 22:22:11 -08:00
purgatory purgatory: fix disabling debug info 2023-04-08 19:36:53 +09:00
tools riscv: Check relocations at compile time 2023-04-19 07:46:32 -07:00
Kbuild riscv: move errata/ and kvm/ builds to arch/riscv/Kbuild 2022-06-01 22:26:32 -07:00
Kconfig Merge patch series "riscv: Add vector ISA support" 2023-06-08 07:17:09 -07:00
Kconfig.debug
Kconfig.errata Merge patch series "RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency" 2023-03-29 12:26:38 -07:00
Kconfig.socs RISC-V Patches for the 6.3 Merge Window, Part 1 2023-02-25 11:14:08 -08:00
Makefile riscv: Enable Vector code to be built 2023-06-08 07:16:56 -07:00
Makefile.postlink riscv: Use --emit-relocs in order to move .rela.dyn in init 2023-04-19 07:46:33 -07:00