The patch titled Subject: powerpc/64s/radix: enable huge vmalloc mappings has been added to the -mm tree. Its filename is powerpc-64s-radix-enable-huge-vmalloc-mappings.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/powerpc-64s-radix-enable-huge-vmalloc-mappings.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/powerpc-64s-radix-enable-huge-vmalloc-mappings.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Nicholas Piggin <npiggin@xxxxxxxxx> Subject: powerpc/64s/radix: enable huge vmalloc mappings This reduces TLB misses by nearly 30x on a `git diff` workload on a 2-node POWER9 (59,800 -> 2,100) and reduces CPU cycles by 0.54%, due to vfs hashes being allocated with 2MB pages. Link: https://lkml.kernel.org/r/20210317062402.533919-15-npiggin@xxxxxxxxx Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx> Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Ding Tianhong <dingtianhong@xxxxxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/admin-guide/kernel-parameters.txt | 2 + arch/powerpc/Kconfig | 1 arch/powerpc/kernel/module.c | 22 +++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) --- a/arch/powerpc/Kconfig~powerpc-64s-radix-enable-huge-vmalloc-mappings +++ a/arch/powerpc/Kconfig @@ -181,6 +181,7 @@ config PPC select GENERIC_GETTIMEOFDAY select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU + select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14 select HAVE_ARCH_KASAN_VMALLOC if PPC32 && PPC_PAGE_SHIFT <= 14 --- a/arch/powerpc/kernel/module.c~powerpc-64s-radix-enable-huge-vmalloc-mappings +++ a/arch/powerpc/kernel/module.c @@ -8,6 +8,7 @@ #include <linux/moduleloader.h> #include <linux/err.h> #include <linux/vmalloc.h> +#include <linux/mm.h> #include <linux/bug.h> #include <asm/module.h> #include <linux/uaccess.h> @@ -87,13 +88,26 @@ int module_finalize(const Elf_Ehdr *hdr, return 0; } -#ifdef MODULES_VADDR void *module_alloc(unsigned long size) { + unsigned long start = VMALLOC_START; + unsigned long end = VMALLOC_END; + +#ifdef MODULES_VADDR BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); + start = MODULES_VADDR; + end = MODULES_END; +#endif - return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, GFP_KERNEL, - PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE, + /* + * Don't do huge page allocations for modules yet until more testing + * is done. STRICT_MODULE_RWX may require extra work to support this + * too. + */ + + return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL, + PAGE_KERNEL_EXEC, + VM_NO_HUGE_VMAP | VM_FLUSH_RESET_PERMS, + NUMA_NO_NODE, __builtin_return_address(0)); } -#endif --- a/Documentation/admin-guide/kernel-parameters.txt~powerpc-64s-radix-enable-huge-vmalloc-mappings +++ a/Documentation/admin-guide/kernel-parameters.txt @@ -3243,6 +3243,8 @@ nohugeiomap [KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings. + nohugevmalloc [PPC] Disable kernel huge vmalloc mappings. + nosmt [KNL,S390] Disable symmetric multithreading (SMT). Equivalent to smt=1. _ Patches currently in -mm which might be from npiggin@xxxxxxxxx are arm-mm-add-missing-pud_page-define-to-2-level-page-tables.patch mm-vmalloc-fix-huge_vmap-regression-by-enabling-huge-pages-in-vmalloc_to_page.patch mm-apply_to_pte_range-warn-and-fail-if-a-large-pte-is-encountered.patch mm-vmalloc-rename-vmap__range-vmap_pages__range.patch mm-ioremap-rename-ioremap__range-to-vmap__range.patch mm-huge_vmap-arch-support-cleanup.patch powerpc-inline-huge-vmap-supported-functions.patch arm64-inline-huge-vmap-supported-functions.patch x86-inline-huge-vmap-supported-functions.patch mm-vmalloc-provide-fallback-arch-huge-vmap-support-functions.patch mm-move-vmap_range-from-mm-ioremapc-to-mm-vmallocc.patch mm-vmalloc-add-vmap_range_noflush-variant.patch mm-vmalloc-hugepage-vmalloc-mappings.patch powerpc-64s-radix-enable-huge-vmalloc-mappings.patch