huge vmalloc mappings
Subsystems (8)
Nicholas Piggin
reviewerv2 cover huge vmalloc mappings
We can get a significant win with larger mappings for some of the big global hashes.
Since RFC, relevant architectures have added p?d_leaf accessors so no real arch changes required, and I changed it not to allocate huge mappings for modules and a bunch of other fixes.
Nicholas Piggin (4):
mm/vmalloc: fix vmalloc_to_page for huge vmap mappings
mm: Move ioremap page table mapping function to mm/
mm: HUGE_VMAP arch query functions cleanup mm/vmalloc: Hugepage vmalloc mappings
arch/arm64/mm/mmu.c | 8 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 6 +- arch/x86/mm/ioremap.c | 6 +- include/linux/io.h | 3 - include/linux/vmalloc.h | 15 + lib/ioremap.c | 203 +---------- mm/vmalloc.c | 413 +++++++++++++++++++---- 7 files changed, 380 insertions(+), 274 deletions(-)
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH v2 1/4 mm/vmalloc: fix vmalloc_to_page for huge vmap mappings
vmalloc_to_page returns NULL for addresses mapped by larger pages[*]. Whether or not a vmap is huge depends on the architecture details, alignments, boot options, etc., which the caller can not be expected to know. Therefore HUGE_VMAP is a regression for vmalloc_to_page.
This change teaches vmalloc_to_page about larger pages, and returns the struct page that corresponds to the offset within the large page. This makes the API agnostic to mapping implementation details.
[*] As explained by commit 029c54b095995 ("mm/vmalloc.c: huge-vmap:
fail gracefully on unexpected huge vmap mappings")
--- mm/vmalloc.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-)
mm/vmalloc.c +26 -14
@@ -36,6 +36,7 @@#include <linux/rbtree_augmented.h> #include <linux/uaccess.h> +#include <asm/pgtable.h> #include <asm/tlbflush.h> #include <asm/shmparam.h>
@@ -272,7 +273,9 @@ int is_vmalloc_or_module_addr(const void *x) }/* -* Walk a vmap address to the struct page it maps. +* Walk a vmap address to the struct page it maps. Huge vmap mappings will +* return the tail page that corresponds to the base page address, which +* matches small vmap mappings. */ struct page *vmalloc_to_page (const void *vmalloc_addr) {
@@ -292,25 +295,33 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)if (pgd_none (*pgd))return NULL ; +if (WARN_ON_ONCE (pgd_leaf (*pgd))) +return NULL ;/* XXX: no allowance for huge pgd */ +if (WARN_ON_ONCE (pgd_bad (*pgd))) +return NULL ; + p4d =p4d_offset (pgd, addr);if (p4d_none (*p4d))return NULL ; - pud =pud_offset (p4d, addr); +if (p4d_leaf (*p4d)) +return p4d_page (*p4d) + ((addr & ~P4D_MASK ) >>PAGE_SHIFT ); +if (WARN_ON_ONCE (p4d_bad (*p4d))) +return NULL ; -/* -* Don't dereference bad PUD or PMD (below) entries. This will also -* identify huge mappings, which we may encounter on architectures -* that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be -* identified as vmalloc addresses by is_vmalloc_addr(), but are -* not [unambiguously] associated with a struct page, so there is -* no correct value to return for them. -*/ -WARN_ON_ONCE (pud_bad (*pud)); -if (pud_none (*pud) ||pud_bad (*pud)) + pud =pud_offset (p4d, addr); +if (pud_none (*pud)) +return NULL ; +if (pud_leaf (*pud)) +return pud_page (*pud) + ((addr & ~PUD_MASK ) >>PAGE_SHIFT ); +if (WARN_ON_ONCE (pud_bad (*pud)))return NULL ; + pmd =pmd_offset (pud, addr); -WARN_ON_ONCE (pmd_bad (*pmd)); -if (pmd_none (*pmd) ||pmd_bad (*pmd)) +if (pmd_none (*pmd)) +return NULL ; +if (pmd_leaf (*pmd)) +return pmd_page (*pmd) + ((addr & ~PMD_MASK ) >>PAGE_SHIFT ); +if (WARN_ON_ONCE (pmd_bad (*pmd)))return NULL ; ptep =pte_offset_map (pmd, addr);
@@ -318,6 +329,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)if (pte_present (pte)) page =pte_page (pte);pte_unmap (ptep); +return page; }EXPORT_SYMBOL (vmalloc_to_page);
Signature · 1 line
2.23.0
Re: [PATCH v2 1/4] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings
Quoted 8 lines · Nicholas Piggin
vmalloc_to_pagereturns NULL for addresses mapped by larger pages[*]. Whether or not a vmap is huge depends on the architecture details, alignments, boot options, etc., which the caller can not be expected to know. ThereforeHUGE_VMAPis a regression forvmalloc_to_page.This change teaches
vmalloc_to_pageabout larger pages, and returns the struct page that corresponds to the offset within the large page. This makes the API agnostic to mapping implementation details.
I'm trying to get us away from returning tail pages from various functions. How much of a pain would it be to return the head page instead of the tail page? Obviously the implementation gets simpler, but can the callers cope? I've been focusing on the page cache, so I haven't been looking at the vmalloc side of things at all.
Nicholas Piggin
reviewerRe: [PATCH v2 1/4] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings
Excerpts from Matthew Wilcox's message of April 13, 2020 11:34 pm:
Quoted 6 lines · Nicholas Piggin
Quoted 5 lines
vmalloc_to_pagereturns NULL for addresses mapped by larger pages[*]. Whether or not a vmap is huge depends on the architecture details, alignments, boot options, etc., which the caller can not be expected to know. ThereforeHUGE_VMAPis a regression forvmalloc_to_page.
Quoted 7 lines
Quoted 3 lines
This change teaches
vmalloc_to_pageabout larger pages, and returns the struct page that corresponds to the offset within the large page. This makes the API agnostic to mapping implementation details.I'm trying to get us away from returning tail pages from various functions. How much of a pain would it be to return the head page instead of the tail page?
Well, this is a fix for the interface for HUGE_VMAP stuff so it doesn't really make sense to change the implementation here. If you want to change or make a different API that would be a later patch, no?
Quoted 3 lines
Obviously the implementation gets simpler,
but can the callers cope? I've been focusing on the page cache, so I haven't been looking at the vmalloc side of things at all.
Well callers that operate on ioremap today (and vmalloc tomorrow) won't cope, because they're expecting a base page. If you wanted to change it I suspect the way to go would be introduce a new function and move everyone over individually.
Thanks,
Nick
Nicholas Piggin
reviewerPATCH v2 2/4 mm: Move ioremap page table mapping function to mm/
In reply to Nicholas Pigginioremap_page_range is a generic function to create a kernel virtual mapping, move it to mm/vmalloc.c and rename it vmap_range.
For clarity with this move, also:
- Rename vunmap_page_range (vmap_range's inverse) to vunmap_range.
- Rename vmap_pages_range (which takes a page array) to vmap_pages.
--- include/linux/vmalloc.h | 3 + lib/ioremap.c | 182 +++--------------------------- mm/vmalloc.c | 239 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 239 insertions(+), 185 deletions(-)
include/linux/vmalloc.h +3 -0
@@ -173,6 +173,9 @@ extern struct vm_struct *find_vm_area(const void *addr);extern int map_vm_area (struct vm_struct *area,pgprot_t prot,struct page **pages);#ifdef CONFIG_MMU +int vmap_range (unsigned long addr, +unsigned long end,phys_addr_t phys_addr,pgprot_t prot, +unsigned int max_page_shift);extern int map_kernel_range_noflush (unsigned long start,unsigned long size,pgprot_t prot,struct page **pages);extern void unmap_kernel_range_noflush (unsigned long addr,unsigned long size);
lib/ioremap.c +16 -166
192 lines not on this page · raw message
mm/vmalloc.c +220 -19
349 lines not on this page · raw message
Signature · 1 line
2.23.0
Nicholas Piggin
reviewerPATCH v2 3/4 mm: HUGE_VMAP arch query functions cleanup
In reply to Nicholas PigginThis changes the awkward approach where architectures provide init functions to determine which levels they can provide large mappings for, to one where the arch is queried for each call.
This allows odd configurations to be allowed (PUD but not PMD), and will make it easier to constant-fold dead code away if the arch inlines unsupported levels.
This also adds a prot argument to the arch query. This is unused currently but could help with some architectures (some powerpc implementations can't map uncacheable memory with large pages for example).
The name is changed from ioremap to vmap, as it will be used more generally in the next patch.
--- arch/arm64/mm/mmu.c | 8 ++-- arch/powerpc/mm/book3s64/radix_pgtable.c | 6 +-- arch/x86/mm/ioremap.c | 6 +-- include/linux/io.h | 3 -- include/linux/vmalloc.h | 10 +++++ lib/ioremap.c | 51 ++---------------------- mm/vmalloc.c | 9 +++++ 7 files changed, 33 insertions(+), 60 deletions(-)
arch/arm64/mm/mmu.c +4 -4
@@ -1244,12 +1244,12 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot)return dt_virt; } -int __init arch_ioremap_p4d_supported (void ) +bool arch_vmap_p4d_supported (pgprot_t prot) {return 0 ; } -int __init arch_ioremap_pud_supported (void ) +bool arch_vmap_pud_supported (pgprot_t prot) {/* * Only 4k granule supports level 1 block mappings.
@@ -1259,9 +1259,9 @@ int __init arch_ioremap_pud_supported(void) !IS_ENABLED (CONFIG_PTDUMP_DEBUGFS ); } -int __init arch_ioremap_pmd_supported (void ) +bool arch_vmap_pmd_supported (pgprot_t prot) { -/* See arch_ioremap_pud_supported() */ +/* See arch_vmap_pud_supported() */ return !IS_ENABLED (CONFIG_PTDUMP_DEBUGFS ); }
arch/powerpc/mm/book3s64/radix_pgtable.c +3 -3
@@ -1091,13 +1091,13 @@ void radix__ptep_modify_prot_commit(struct vm_area_struct *vma,set_pte_at (mm, addr, ptep, pte); } -int __init arch_ioremap_pud_supported (void ) +bool arch_vmap_pud_supported (pgprot_t prot) {/* HPT does not cope with large pages in the vmalloc area */ return radix_enabled (); } -int __init arch_ioremap_pmd_supported (void ) +bool arch_vmap_pmd_supported (pgprot_t prot) {return radix_enabled (); }
@@ -1191,7 +1191,7 @@ int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)return 1 ; } -int __init arch_ioremap_p4d_supported (void ) +bool arch_vmap_p4d_supported (pgprot_t prot) {return 0 ; }
arch/x86/mm/ioremap.c +3 -3
@@ -481,12 +481,12 @@ void iounmap(volatile void __iomem *addr) }EXPORT_SYMBOL (iounmap); -int __init arch_ioremap_p4d_supported (void ) +bool arch_vmap_p4d_supported (pgprot_t prot) {return 0 ; } -int __init arch_ioremap_pud_supported (void ) +bool arch_vmap_pud_supported (pgprot_t prot) {#ifdef CONFIG_X86_64 return boot_cpu_has (X86_FEATURE_GBPAGES );
@@ -495,7 +495,7 @@ int __init arch_ioremap_pud_supported(void)#endif } -int __init arch_ioremap_pmd_supported (void ) +bool arch_vmap_pmd_supported (pgprot_t prot) {return boot_cpu_has (X86_FEATURE_PSE ); }
include/linux/io.h +0 -3
@@ -33,9 +33,6 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP void __init ioremap_huge_init (void ); -int arch_ioremap_p4d_supported (void ); -int arch_ioremap_pud_supported (void ); -int arch_ioremap_pmd_supported (void );#else static inline void ioremap_huge_init (void ) { }#endif
include/linux/vmalloc.h +10 -0
@@ -84,6 +84,16 @@ struct vmap_area { }; }; +#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP +bool arch_vmap_p4d_supported (pgprot_t prot); +bool arch_vmap_pud_supported (pgprot_t prot); +bool arch_vmap_pmd_supported (pgprot_t prot); +#else +static inline bool arch_vmap_p4d_supported (pgprot_t prot) {return false; } +static inline bool arch_vmap_pud_supported (pgprot_t prot) {return false; } +static inline bool arch_vmap_pmd_supported (prprot_t prot) {return false; } +#endif +/* * Highlevel APIs for driver use */
lib/ioremap.c +4 -47
70 lines not on this page · raw message
mm/vmalloc.c +9 -0
@@ -171,6 +171,9 @@ static int vmap_try_huge_pmd(pmd_t *pmd, unsigned long addr, unsigned long end,if (max_page_shift <PMD_SHIFT )return 0 ; +if (!arch_vmap_pmd_supported (prot)) +return 0 ; +if ((end - addr) !=PMD_SIZE )return 0 ;
@@ -219,6 +222,9 @@ static int vmap_try_huge_pud(pud_t *pud, unsigned long addr,if (max_page_shift <PUD_SHIFT )return 0 ; +if (!arch_vmap_pud_supported (prot)) +return 0 ; +if ((end - addr) !=PUD_SIZE )return 0 ;
@@ -268,6 +274,9 @@ static int vmap_try_huge_p4d(p4d_t *p4d, unsigned long addr,if (max_page_shift <P4D_SHIFT )return 0 ; +if (!arch_vmap_p4d_supported (prot)) +return 0 ; +if ((end - addr) !=P4D_SIZE )return 0 ;
Signature · 1 line
2.23.0
kbuild test robot
build botRe: [PATCH v2 3/4] mm: HUGE_VMAP arch query functions cleanup
I love your patch! Yet something to improve:
Hi Nicholas,
I love your patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on powerpc/next tip/x86/mm linus/master v5.7-rc1 next-20200413] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/huge-vmalloc-mappings/20200414-031028 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: i386-tinyconfig (attached as .config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
In file included from include/asm-generic/io.h:887:0,
from arch/x86/include/asm/io.h:375,
from arch/x86/include/asm/dma.h:13,
from include/linux/memblock.h:14,
from arch/x86/mm/ioremap.c:10:
include/linux/vmalloc.h:94:44: error: unknown type name 'prprot_t'; did you mean 'pgprot_t'?
static inline bool arch_vmap_pmd_supported(prprot_t prot) { return false; }
^~~~~~~~
pgprot_t
>> arch/x86/mm/ioremap.c:463:6: error: redefinition of 'arch_vmap_p4d_supported'
bool arch_vmap_p4d_supported(pgprot_t prot)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/io.h:887:0,
from arch/x86/include/asm/io.h:375,
from arch/x86/include/asm/dma.h:13,
from include/linux/memblock.h:14,
from arch/x86/mm/ioremap.c:10:
include/linux/vmalloc.h:92:20: note: previous definition of 'arch_vmap_p4d_supported' was here
static inline bool arch_vmap_p4d_supported(pgprot_t prot) { return false; }
^~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/mm/ioremap.c:468:6: error: redefinition of 'arch_vmap_pud_supported'
bool arch_vmap_pud_supported(pgprot_t prot)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/io.h:887:0,
from arch/x86/include/asm/io.h:375,
from arch/x86/include/asm/dma.h:13,
from include/linux/memblock.h:14,
from arch/x86/mm/ioremap.c:10:
include/linux/vmalloc.h:93:20: note: previous definition of 'arch_vmap_pud_supported' was here
static inline bool arch_vmap_pud_supported(pgprot_t prot) { return false; }
^~~~~~~~~~~~~~~~~~~~~~~vim +/arch_vmap_p4d_supported +463 arch/x86/mm/ioremap.c
462
> 463 bool arch_vmap_p4d_supported(pgprot_t prot)
464 {
465 return 0;
466 }
467
> 468 bool arch_vmap_pud_supported(pgprot_t prot) 469 {
470 #ifdef CONFIG_X86_64
471 return boot_cpu_has(X86_FEATURE_GBPAGES);
472 #else
473 return 0;
474 #endif
475 }
476
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botRe: [PATCH v2 3/4] mm: HUGE_VMAP arch query functions cleanup
In reply to Nicholas PigginI love your patch! Yet something to improve:
Hi Nicholas,
I love your patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on powerpc/next tip/x86/mm linus/master v5.7-rc1 next-20200413] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/huge-vmalloc-mappings/20200414-031028 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: nds32-defconfig (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] In file included from include/asm-generic/io.h:887,
from arch/nds32/include/asm/io.h:82,
from arch/nds32/kernel/vdso/gettimeofday.c:7:
>> include/linux/vmalloc.h:94:44: error: unknown type name 'prprot_t'; did you mean 'pgprot_t'?
94 | static inline bool arch_vmap_pmd_supported(prprot_t prot) { return false; }
| ^~~~~~~~
| pgprot_t make[2]: *** [scripts/Makefile.build:268: arch/nds32/kernel/vdso/gettimeofday.o] Error 1 make[2]: Target 'include/generated/vdso-offsets.h' not remade because of errors. make[1]: *** [arch/nds32/Makefile:63: vdso_prepare] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:179: sub-make] Error 2
35 real 5 user 12 sys 50.54% cpu make prepare
vim +94 include/linux/vmalloc.h
86
87 #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
88 bool arch_vmap_p4d_supported(pgprot_t prot);
89 bool arch_vmap_pud_supported(pgprot_t prot);
90 bool arch_vmap_pmd_supported(pgprot_t prot);
91 #else
92 static inline bool arch_vmap_p4d_supported(pgprot_t prot) { return false; }
93 static inline bool arch_vmap_pud_supported(pgprot_t prot) { return false; }
> 94 static inline bool arch_vmap_pmd_supported(prprot_t prot) { return false; }
95 #endif
96 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botRe: [PATCH v2 3/4] mm: HUGE_VMAP arch query functions cleanup
In reply to Nicholas PigginI love your patch! Perhaps something to improve:
Hi Nicholas,
I love your patch! Perhaps something to improve:
[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on powerpc/next tip/x86/mm linus/master v5.7-rc1 next-20200413] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/huge-vmalloc-mappings/20200414-031028 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
If you fix the issue, kindly add following tag as appropriate
coccinelle warnings: (new ones prefixed by >>)
>> arch/x86/mm/ioremap.c:465:8-9: WARNING: return of 0/1 in function 'arch_vmap_p4d_supported' with return type bool >> arch/x86/mm/ioremap.c:473:8-9: WARNING: return of 0/1 in function 'arch_vmap_pud_supported' with return type bool
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build bot[PATCH] mm: fix boolreturn.cocci warnings
In reply to Nicholas Pigginarch/x86/mm/ioremap.c:465:8-9: WARNING: return of 0/1 in function 'arch_vmap_p4d_supported' with return type bool arch/x86/mm/ioremap.c:473:8-9: WARNING: return of 0/1 in function…
From: kbuild test robot <[email protected]>
arch/x86/mm/ioremap.c:465:8-9: WARNING: return of 0/1 in function 'arch_vmap_p4d_supported' with return type bool arch/x86/mm/ioremap.c:473:8-9: WARNING: return of 0/1 in function 'arch_vmap_pud_supported' with return type bool
Return statements in functions returning bool should use true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci
---
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/huge-vmalloc-mappings/20200414-031028 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
ioremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/ioremap.c +2 -2
@@ -462,7 +462,7 @@ EXPORT_SYMBOL(iounmap);bool arch_vmap_p4d_supported (pgprot_t prot) { -return 0 ; +return false; }bool arch_vmap_pud_supported (pgprot_t prot)
@@ -470,7 +470,7 @@ bool arch_vmap_pud_supported(pgprot_t pr#ifdef CONFIG_X86_64 return boot_cpu_has (X86_FEATURE_GBPAGES );#else -return 0 ; +return false;#endif }
Nicholas Piggin
reviewerPATCH v2 4/4 mm/vmalloc: Hugepage vmalloc mappings
In reply to Nicholas PigginFor platforms that define HAVE_ARCH_HUGE_VMAP and support PMD vmap mappings, have vmalloc attempt to allocate PMD-sized pages first, before falling back to small pages. Allocations which use something other than PAGE_KERNEL protections are not permitted to use huge pages yet, not all callers expect this (e.g., module allocations vs strict module rwx).
This gives a 6x reduction in dTLB misses for a git diff (of linux), from 45600 to 6500 and a 2.2% reduction in cycles on a 2-node POWER9.
This can result in more internal fragmentation and memory overhead for a given allocation. It can also cause greater NUMA unbalance on hashdist allocations.
There may be other callers that expect small pages under vmalloc but use PAGE_KERNEL, I'm not sure if it's feasible to catch them all. An alternative would be a new function or flag which enables large mappings, and use that in callers.
--- include/linux/vmalloc.h | 2 + mm/vmalloc.c | 135 +++++++++++++++++++++++++++++----------- 2 files changed, 102 insertions(+), 35 deletions(-)
include/linux/vmalloc.h +2 -0
@@ -24,6 +24,7 @@ struct notifier_block; /* in notifier.h */#define VM_UNINITIALIZED 0x00000020/* vm_struct is not fully initialized */ #define VM_NO_GUARD 0x00000040/* don't add guard page */ #define VM_KASAN 0x00000080/* has allocated kasan shadow memory */ +#define VM_HUGE_PAGES 0x00000100/* may use huge pages */ /* * VM_KASAN is used slighly differently depending on CONFIG_KASAN_VMALLOC.
@@ -58,6 +59,7 @@ struct vm_struct {unsigned long size;unsigned long flags;struct page **pages; +unsigned int page_order;unsigned int nr_pages;phys_addr_t phys_addr;const void *caller;
mm/vmalloc.c +100 -35
279 lines not on this page · raw message
Signature · 1 line
2.23.0
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
mm/vmalloc.c static int vmap_pages_range_noflush(unsigned long start, unsigned long end, · line 464
Quoted 5 lines · Nicholas Piggin
mm/vmalloc.c +5
-0+static int vmap_pages_range_noflush (unsigned long start,unsigned long end, +pgprot_t prot,struct page **pages, +unsigned int page_shift) +{ +if (page_shift ==PAGE_SIZE ) {
... I think you meant 'page_shift == PAGE_SHIFT'
Overall I like this series, although it's a bit biased towards CPUs which have page sizes which match PMD/PUD sizes. It doesn't offer the possibility of using 64kB page sizes on ARM, for example. But it's a step in the right direction.
Nicholas Piggin
reviewerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Matthew Wilcox's message of April 13, 2020 11:41 pm:
Quoted 8 lines · Nicholas Piggin
mm/vmalloc.c static int vmap_pages_range_noflush(unsigned long start, unsigned long end, · line 464
Quoted 5 lines
mm/vmalloc.c +5
-0+static int vmap_pages_range_noflush (unsigned long start,unsigned long end, +pgprot_t prot,struct page **pages, +unsigned int page_shift) +{ +if (page_shift ==PAGE_SIZE ) {... I think you meant '
page_shift==PAGE_SHIFT'
Thanks, good catch. I obviously didn't test the fallback path (the other path works for small pages, it just goes one at a time).
Quoted 3 lines
Overall I like this series, although it's a bit biased towards CPUs which have page sizes which match PMD/PUD sizes. It doesn't offer the possibility of using 64kB page sizes on ARM, for example.
No, it's just an incremental step on existing huge vmap stuff in tree, so such a thing would be out of scope.
Quoted 3 lines
But it's a
step in the right direction.
I don't know about moving kernel maps away from a generic Linux page table format. I quite like moving to it and making it as generic as possible.
On the other hand, I also would like to make some arch-specific allowances for certain special cases that may not fit within the standard page table format, but it might be a much more specific and limited interface than the general vmalloc stuff.
Thanks,
Nick
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
In reply to Matthew WilcoxLe 13/04/2020 à 15:41, Matthew Wilcox a écrit :
Quoted 9 lines · Nicholas Piggin
mm/vmalloc.c static int vmap_pages_range_noflush(unsigned long start, unsigned long end, · line 464
Quoted 5 lines
mm/vmalloc.c +5
-0+static int vmap_pages_range_noflush (unsigned long start,unsigned long end, +pgprot_t prot,struct page **pages, +unsigned int page_shift) +{ +if (page_shift ==PAGE_SIZE ) {... I think you meant '
page_shift==PAGE_SHIFT'
Quoted 5 lines
Overall I like this series, although it's a bit biased towards CPUs which have page sizes which match PMD/PUD sizes. It doesn't offer the possibility of using 64kB page sizes on ARM, for example. But it's a step in the right direction.
I was going to ask more or less the same question, I would have liked to use 512kB hugepages on powerpc 8xx.
Even the 8M hugepages (still on the 8xx), can they be used as well, taking into account that two PGD entries have to point to the same 8M page ?
I sent out a series which tends to make the management of 512k and 8M pages closer to what Linux expects, in order to use them inside kernel, for Linear mappings and Kasan mappings for the moment. See https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=164620
It would be nice if we could amplify it a use it for ioremaps and vmallocs as well.
Christophe
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Quoted 21 lines · Christophe Leroy
Le 13/04/2020 à 15:41, Matthew Wilcox a écrit :
Quoted 9 lines · Nicholas Piggin
mm/vmalloc.c static int vmap_pages_range_noflush(unsigned long start, unsigned long end, · line 464
Quoted 5 lines
mm/vmalloc.c +5
-0+static int vmap_pages_range_noflush (unsigned long start,unsigned long end, +pgprot_t prot,struct page **pages, +unsigned int page_shift) +{ +if (page_shift ==PAGE_SIZE ) {... I think you meant '
page_shift==PAGE_SHIFT'Quoted 4 lines
Overall I like this series, although it's a bit biased towards CPUs which have page sizes which match PMD/PUD sizes. It doesn't offer the possibility of using 64kB page sizes on ARM, for example. But it's a step in the right direction.
I was going to ask more or less the same question, I would have liked to use 512kB hugepages on powerpc 8xx.
Even the 8M hugepages (still on the 8xx), can they be used as well, taking into account that two PGD entries have to point to the same 8M page ?
Quoted 6 lines
I sent out a series which tends to make the management of 512k and 8M pages closer to what Linux expects, in order to use them inside kernel, for Linear mappings and Kasan mappings for the moment. See
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=164620
It would be nice if we could amplify it a use it for ioremaps and vmallocs as well.
I haven't been looking at vmalloc at all; I've been looking at the page cache. See:
https://lore.kernel.org/linux-mm/[email protected]/
Once we have large pages in the page cache, I want to sort out the API for asking the CPU to insert a TLB entry. Right now, we use set_pte_at(), set_pmd_at() and set_pud_at(). I'm thinking something along the lines of:
vm_fault_t vmf_set_page_at(struct vm_fault *vmf, struct page *page);
and the architecture can insert whatever PTEs and/or TLB entries it likes based on compound_order(page) -- if, say, it's a 1MB page, it might choose to insert 2 * 512kB entries, or just the upper or lower 512kB entry (depending which half of the 1MB page the address sits in).
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
In reply to Nicholas PigginQuoted 9 lines · Nicholas Piggin
For platforms that define
HAVE_ARCH_HUGE_VMAPand support PMD vmap mappings, have vmalloc attempt to allocate PMD-sized pages first, before falling back to small pages. Allocations which use something other thanPAGE_KERNELprotections are not permitted to use huge pages yet, not all callers expect this (e.g., module allocations vs strict module rwx).This gives a 6x reduction in dTLB misses for a
git diff(of linux), from 45600 to 6500 and a 2.2% reduction in cycles on a 2-node POWER9.
Quoted 8 lines
This can result in more internal fragmentation and memory overhead for a given allocation. It can also cause greater NUMA unbalance on hashdist allocations.
There may be other callers that expect small pages under vmalloc but use
PAGE_KERNEL, I'm not sure if it's feasible to catch them all. An alternative would be a new function or flag which enables large mappings, and use that in callers.
Why do we even use vmalloc in this case rather than just doing a huge page allocation? What callers are you intersted in?
Nicholas Piggin
reviewerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Christoph Hellwig's message of April 14, 2020 5:23 pm:
Quoted 14 lines · Nicholas Piggin
Quoted 13 lines
For platforms that define
HAVE_ARCH_HUGE_VMAPand support PMD vmap mappings, have vmalloc attempt to allocate PMD-sized pages first, before falling back to small pages. Allocations which use something other thanPAGE_KERNELprotections are not permitted to use huge pages yet, not all callers expect this (e.g., module allocations vs strict module rwx).This gives a 6x reduction in dTLB misses for a
git diff(of linux), from 45600 to 6500 and a 2.2% reduction in cycles on a 2-node POWER9.This can result in more internal fragmentation and memory overhead for a given allocation. It can also cause greater NUMA unbalance on hashdist allocations.
Quoted 7 lines
Quoted 4 lines
There may be other callers that expect small pages under vmalloc but use
PAGE_KERNEL, I'm not sure if it's feasible to catch them all. An alternative would be a new function or flag which enables large mappings, and use that in callers.Why do we even use vmalloc in this case rather than just doing a huge page allocation?
Which case? Usually the answer would be because you don't want to use contiguous physical memory and/or you don't want to use the linear mapping.
Quoted 1 line
What callers are you intersted in?
The dentry and inode caches for this test, obviously.
Lots of other things could possibly benefit though, other system hashes like networking, but lot of other vmalloc callers that might benefit right away, some others could use some work to batch up allocation sizes to benefit.
Thanks,
Nick
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Quoted 3 lines · Nicholas Piggin
Which case? Usually the answer would be because you don't want to use contiguous physical memory and/or you don't want to use the linear mapping.
But with huge pages you do by definition already use large contiguous areas. So you want allocations larger than "small" huge pages but not using gigantic pages using vmalloc?
Nicholas Piggin
reviewerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Christoph Hellwig's message of April 14, 2020 11:02 pm:
Quoted 8 lines · Nicholas Piggin
Quoted 3 lines
Which case? Usually the answer would be because you don't want to use contiguous physical memory and/or you don't want to use the linear mapping.
But with huge pages you do by definition already use large contiguous areas. So you want allocations larger than "small" huge pages but not using gigantic pages using vmalloc?
Yes.
Thanks,
Nick
Will Deacon
maintainerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
In reply to Nicholas PigginHi Nick,
Quoted 8 lines · Nicholas Piggin
For platforms that define
HAVE_ARCH_HUGE_VMAPand support PMD vmap mappings, have vmalloc attempt to allocate PMD-sized pages first, before falling back to small pages. Allocations which use something other thanPAGE_KERNELprotections are not permitted to use huge pages yet, not all callers expect this (e.g., module allocations vs strict module rwx).This gives a 6x reduction in dTLB misses for a
git diff(of linux), from 45600 to 6500 and a 2.2% reduction in cycles on a 2-node POWER9.
I wonder if it's worth extending vmap() to handle higher order pages in a similar way? That might be helpful for tracing PMUs such as Arm SPE, where the CPU streams tracing data out to a virtually addressed buffer (see rb_alloc_aux_page()).
Quoted 20 lines
This can result in more internal fragmentation and memory overhead for a given allocation. It can also cause greater NUMA unbalance on hashdist allocations.
There may be other callers that expect small pages under vmalloc but use
PAGE_KERNEL, I'm not sure if it's feasible to catch them all. An alternative would be a new function or flag which enables large mappings, and use that in callers.Signed-off-by Nicholas Piggin <[email protected]>--- include/linux/vmalloc.h | 2 + mm/vmalloc.c | 135 +++++++++++++++++++++++++++++----------- 2 files changed, 102 insertions(+), 35 deletions(-)include/linux/vmalloc.h +0
-0
include/linux/vmalloc.h struct notifier_block; /* in notifier.h */ · line 27
Quoted 4 lines
include/linux/vmalloc.h +1
-0@@ -24,6 +24,7 @@ struct notifier_block; /* in notifier.h */#define VM_UNINITIALIZED 0x00000020/* vm_struct is not fully initialized */ #define VM_NO_GUARD 0x00000040/* don't add guard page */ #define VM_KASAN 0x00000080/* has allocated kasan shadow memory */ +#define VM_HUGE_PAGES 0x00000100/* may use huge pages */
Please can you add a check for this in the arm64 change_memory_common() code? Other architectures might need something similar, but we need to forbid changing memory attributes for portions of the huge page.
In general, I'm a bit wary of software table walkers tripping over this. For example, I don't think apply_to_existing_page_range() can handle huge mappings at all, but the one user (KASAN) only ever uses page mappings so it's ok there.
include/linux/vmalloc.h static struct vm_struct *__get_vm_area_node(unsigned long size, · line 2363
Quoted 12 lines
include/linux/vmalloc.h +5
-3@@ -2325,9 +2356,11 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,if (unlikely (!size))return NULL ; -if (flags &VM_IOREMAP ) - align =1ul <<clamp_t (int,get_count_order_long (size), -PAGE_SHIFT ,IOREMAP_MAX_ORDER ); +if (flags &VM_IOREMAP ) { + align =max (align, +1ul <<clamp_t (int,get_count_order_long (size), +PAGE_SHIFT ,IOREMAP_MAX_ORDER )); + }
I don't follow this part. Please could you explain why you're potentially aligning above IOREMAP_MAX_ORDER? It doesn't seem to follow from the rest of the patch.
Cheers,
Will
Nicholas Piggin
reviewerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Will Deacon's message of April 15, 2020 8:47 pm:
Quoted 9 lines
Hi Nick,
Quoted 6 lines · Nicholas Piggin
For platforms that define
HAVE_ARCH_HUGE_VMAPand support PMD vmap mappings, have vmalloc attempt to allocate PMD-sized pages first, before falling back to small pages. Allocations which use something other thanPAGE_KERNELprotections are not permitted to use huge pages yet, not all callers expect this (e.g., module allocations vs strict module rwx).
Quoted 7 lines
Quoted 2 lines
This gives a 6x reduction in dTLB misses for a
git diff(of linux), from 45600 to 6500 and a 2.2% reduction in cycles on a 2-node POWER9.I wonder if it's worth extending
vmap()to handle higher order pages in a similar way? That might be helpful for tracing PMUs such as Arm SPE, where the CPU streams tracing data out to a virtually addressed buffer (seerb_alloc_aux_page()).
Yeah it becomes pretty trivial to do that with VM_HUGE_PAGES after this patch, I have something to do it but no callers ready yet, if you have an easy one we can add it.
Quoted 15 lines
Quoted 15 lines
This can result in more internal fragmentation and memory overhead for a given allocation. It can also cause greater NUMA unbalance on hashdist allocations.
There may be other callers that expect small pages under vmalloc but use
PAGE_KERNEL, I'm not sure if it's feasible to catch them all. An alternative would be a new function or flag which enables large mappings, and use that in callers.Signed-off-by Nicholas Piggin <[email protected]>--- include/linux/vmalloc.h | 2 + mm/vmalloc.c | 135 +++++++++++++++++++++++++++++----------- 2 files changed, 102 insertions(+), 35 deletions(-)
Quoted 13 lines
include/linux/vmalloc.h struct notifier_block; /* in notifier.h */ · line 27
Quoted 9 lines
include/linux/vmalloc.h +1
-0@@ -24,6 +24,7 @@ struct notifier_block; /* in notifier.h */#define VM_UNINITIALIZED 0x00000020/* vm_struct is not fully initialized */ #define VM_NO_GUARD 0x00000040/* don't add guard page */ #define VM_KASAN 0x00000080/* has allocated kasan shadow memory */ +#define VM_HUGE_PAGES 0x00000100/* may use huge pages */ Please can you add a check for this in the arm64
change_memory_common()code? Other architectures might need something similar, but we need to forbid changing memory attributes for portions of the huge page.
Yeah good idea, I can look about adding some more checks.
Quoted 5 lines
In general, I'm a bit wary of software table walkers tripping over this. For example, I don't think
apply_to_existing_page_range()can handle huge mappings at all, but the one user (KASAN) only ever uses page mappings so it's ok there.
Right, I have something to warn for apply to page range (and looking at adding support for bigger pages). It doesn't even have a test and warn at the moment which isn't good practice IMO so we should add one even without huge vmap.
Quoted 5 lines
Quoted 5 lines
include/linux/vmalloc.h +0
-0@@ -2325,9 +2356,11 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,if (unlikely (!size))return NULL ;
Quoted 13 lines
include/linux/vmalloc.h static struct vm_struct *__get_vm_area_node(unsigned long size, · line 2363
Quoted 8 lines
include/linux/vmalloc.h +5
-3-if (flags &VM_IOREMAP ) - align =1ul <<clamp_t (int,get_count_order_long (size), -PAGE_SHIFT ,IOREMAP_MAX_ORDER ); +if (flags &VM_IOREMAP ) { + align =max (align, +1ul <<clamp_t (int,get_count_order_long (size), +PAGE_SHIFT ,IOREMAP_MAX_ORDER )); + }I don't follow this part. Please could you explain why you're potentially aligning above
IOREMAP_MAX_ORDER? It doesn't seem to follow from the rest of the patch.
Trying to remember. If the caller asks for a particular alignment we shouldn't reduce it. Should put it in another patch.
Thanks,
Nick
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
In reply to Nicholas PigginQuoted 14 lines
static void *__vmalloc_node(unsigned long size, unsigned long align,
mm/vmalloc.c +7
-3- gfp_t gfp_mask, pgprot_t prot, - int node, const void *caller); + gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, + int node, const void *caller);static void *__vmalloc_area_node (struct vm_struct *area,gfp_t gfp_mask, -pgprot_t prot,int node) +pgprot_t prot,unsigned int page_shift, +int node) {struct page **pages; +unsigned long addr = (unsigned long )area->addr; +unsigned long size =get_vm_area_size (area); +unsigned int page_order = page_shift -PAGE_SHIFT ;
mm/vmalloc.c void *vmap(struct page **pages, unsigned int count, · line 2724
Quoted 10 lines
mm/vmalloc.c +2
-3unsigned int nr_pages, array_size, i;const gfp_t nested_gfp = (gfp_mask &GFP_RECLAIM_MASK ) | __GFP_ZERO;const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN;const gfp_t highmem_mask = (gfp_mask & (GFP_DMA |GFP_DMA32 )) ? -0 : - __GFP_HIGHMEM; +0 : __GFP_HIGHMEM; - nr_pages =get_vm_area_size (area) >>PAGE_SHIFT ; + nr_pages = size >> page_shift;
while try out this patchset, we encountered a BUG_ON in account_kernel_stack() in kernel/fork.c.
BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE);
which obviously should be updated accordingly.
Quoted 10 lines
mm/vmalloc.c +1
-1array_size = (nr_pages *sizeof (struct page *));/* Please note that the recursion is strictly bounded. */ if (array_size >PAGE_SIZE ) { pages =__vmalloc_node (array_size,1 , nested_gfp|highmem_mask, -PAGE_KERNEL , node, area->caller); +PAGE_KERNEL ,0 , node, area->caller); }else { pages =kmalloc_node (array_size, nested_gfp, node); }
Nicholas Piggin
reviewerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Zefan Li's message of July 1, 2020 5:10 pm:
Quoted 28 lines
Quoted 14 lines
static void *__vmalloc_node(unsigned long size, unsigned long align,
mm/vmalloc.c +7
-3- gfp_t gfp_mask, pgprot_t prot, - int node, const void *caller); + gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, + int node, const void *caller);static void *__vmalloc_area_node (struct vm_struct *area,gfp_t gfp_mask, -pgprot_t prot,int node) +pgprot_t prot,unsigned int page_shift, +int node) {struct page **pages; +unsigned long addr = (unsigned long )area->addr; +unsigned long size =get_vm_area_size (area); +unsigned int page_order = page_shift -PAGE_SHIFT ;mm/vmalloc.c void *vmap(struct page **pages, unsigned int count, · line 2724
Quoted 10 lines
mm/vmalloc.c +2
-3unsigned int nr_pages, array_size, i;const gfp_t nested_gfp = (gfp_mask &GFP_RECLAIM_MASK ) | __GFP_ZERO;const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN;const gfp_t highmem_mask = (gfp_mask & (GFP_DMA |GFP_DMA32 )) ? -0 : - __GFP_HIGHMEM; +0 : __GFP_HIGHMEM; - nr_pages =get_vm_area_size (area) >>PAGE_SHIFT ; + nr_pages = size >> page_shift;while try out this patchset, we encountered a
BUG_ONinaccount_kernel_stack()inkernel/fork.c.
Quoted 3 lines
BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE);which obviously should be updated accordingly.
Thanks for finding that. We may have to change this around a bit so nr_pages still appears to be in PAGE_SIZE units for anybody looking.
Thanks,
Nick
Re: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
In reply to Nicholas Pigginmm/vmalloc.c static int vmap_pages_range_noflush(unsigned long start, unsigned long end, · line 464
Quoted 5 lines
mm/vmalloc.c +5
-0+static int vmap_pages_range_noflush (unsigned long start,unsigned long end, +pgprot_t prot,struct page **pages, +unsigned int page_shift) +{ +if (page_shift ==PAGE_SIZE ) {
Is this a typo of PAGE_SHIFT?
Quoted 22 lines
mm/vmalloc.c +22
-0+return vmap_small_pages_range_noflush (start, end, prot, pages); + }else { +unsigned long addr = start; +unsigned int i, nr = (end - start) >> page_shift; + +for (i =0 ; i < nr; i++) { +int err; + + err =vmap_range_noflush (addr, + addr + (1UL << page_shift), +__pa (page_address (pages[i])), prot, + page_shift); +if (err) +return err; + + addr +=1UL << page_shift; + } + +return 0 ; + } +} +
Nicholas Piggin
reviewerRe: [PATCH v2 4/4] mm/vmalloc: Hugepage vmalloc mappings
Excerpts from Zefan Li's message of July 20, 2020 12:02 pm:
Quoted 7 lines
mm/vmalloc.c static int vmap_pages_range_noflush(unsigned long start, unsigned long end, · line 464
Quoted 5 lines
mm/vmalloc.c +5
-0+static int vmap_pages_range_noflush (unsigned long start,unsigned long end, +pgprot_t prot,struct page **pages, +unsigned int page_shift) +{ +if (page_shift ==PAGE_SIZE ) {Is this a typo of
PAGE_SHIFT?
Oh good catch, yeah that'll always be going via the one-at-a-time route and slow down the small page vmaps. Will fix.
Thanks,
Nick
Quoted 24 lines
Quoted 23 lines
mm/vmalloc.c +22
-0+return vmap_small_pages_range_noflush (start, end, prot, pages); + }else { +unsigned long addr = start; +unsigned int i, nr = (end - start) >> page_shift; + +for (i =0 ; i < nr; i++) { +int err; + + err =vmap_range_noflush (addr, + addr + (1UL << page_shift), +__pa (page_address (pages[i])), prot, + page_shift); +if (err) +return err; + + addr +=1UL << page_shift; + } + +return 0 ; + } +} +
Quoted 7 lines · Nicholas Piggin
We can get a significant win with larger mappings for some of the big global hashes.
Since RFC, relevant architectures have added p?d_leaf accessors so no real arch changes required, and I changed it not to allocate huge mappings for modules and a bunch of other fixes.
Hi Nicholas,
Any performance numbers to share besides the git diff in the last patch in the series? I'm wondering if anything from mmtests or lkp-tests makes sense to try?
Quoted 20 lines
Nicholas Piggin (4):
mm/vmalloc: fixvmalloc_to_pagefor huge vmap mappings
mm: Move ioremap page table mapping function tomm/
mm:HUGE_VMAParch query functions cleanup mm/vmalloc: Hugepage vmalloc mappingsarch/arm64/mm/mmu.c | 8 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 6 +- arch/x86/mm/ioremap.c | 6 +- include/linux/io.h | 3 - include/linux/vmalloc.h | 15 + lib/ioremap.c | 203 +---------- mm/vmalloc.c | 413 +++++++++++++++++++---- 7 files changed, 380 insertions(+), 274 deletions(-)Signature · 1 line
2.23.0
Nicholas Piggin
reviewerExcerpts from David Rientjes's message of April 14, 2020 10:27 am:
Quoted 10 lines · Nicholas Piggin
Quoted 8 lines
We can get a significant win with larger mappings for some of the big global hashes.
Since RFC, relevant architectures have added p?d_leaf accessors so no real arch changes required, and I changed it not to allocate huge mappings for modules and a bunch of other fixes.
Quoted 5 lines
Hi Nicholas,
Any performance numbers to share besides the git diff in the last patch in the series? I'm wondering if anything from mmtests or lkp-tests makes sense to try?
Hey, no I don't have any other tests I've run. Some of the networking hashes do make use of it as well though, and might see a few % in the right kind of workload. There's probably a bunch of other stuff where it could help a little bit, looking through the tree, I just don't have anything specific.
Thanks,
Nick