Björn Töpel <bjorn@xxxxxxxxxx> writes: > From: Björn Töpel <bjorn@xxxxxxxxxxxx> > > 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@xxxxxxxxxx/ # [1] > Signed-off-by: Björn Töpel <bjorn@xxxxxxxxxxxx> ...and the build was bitten by nommu [1]. I'll hold off the v2 a bit, to see if there's any other comments. Björn [1] https://patchwork.kernel.org/project/linux-riscv/patch/20230529180023.289904-1-bjorn@xxxxxxxxxx/