diff options
| author | Christophe Leroy <[email protected]> | 2021-07-01 01:48:09 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2021-07-01 03:47:26 +0000 |
| commit | 3382bbee0464bf31e63853c6ec2a83ead77a01cc (patch) | |
| tree | 3ecb52156059d2c4f86fffef0e306f6339602c38 /mm/vmalloc.c | |
| parent | mm/vmalloc: enable mapping of huge pages at pte level in vmap (diff) | |
| download | kernel-3382bbee0464bf31e63853c6ec2a83ead77a01cc.tar.gz kernel-3382bbee0464bf31e63853c6ec2a83ead77a01cc.zip | |
mm/vmalloc: enable mapping of huge pages at pte level in vmalloc
On some architectures like powerpc, there are huge pages that are mapped
at pte level.
Enable it in vmalloc.
For that, architectures can provide arch_vmap_pte_supported_shift() that
returns the shift for pages to map at pte level.
Link: https://lkml.kernel.org/r/2c717e3b1fba1894d890feb7669f83025bfa314d.1620795204.git.christophe.leroy@csgroup.eu
Signed-off-by: Christophe Leroy <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Uladzislau Rezki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'mm/vmalloc.c')
| -rw-r--r-- | mm/vmalloc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index fe0af8db71e0..71dd29fe618b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2927,8 +2927,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, return NULL; } - if (vmap_allow_huge && !(vm_flags & VM_NO_HUGE_VMAP) && - arch_vmap_pmd_supported(prot)) { + if (vmap_allow_huge && !(vm_flags & VM_NO_HUGE_VMAP)) { unsigned long size_per_node; /* @@ -2941,11 +2940,13 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, size_per_node = size; if (node == NUMA_NO_NODE) size_per_node /= num_online_nodes(); - if (size_per_node >= PMD_SIZE) { + if (arch_vmap_pmd_supported(prot) && size_per_node >= PMD_SIZE) shift = PMD_SHIFT; - align = max(real_align, 1UL << shift); - size = ALIGN(real_size, 1UL << shift); - } + else + shift = arch_vmap_pte_supported_shift(size_per_node); + + align = max(real_align, 1UL << shift); + size = ALIGN(real_size, 1UL << shift); } again: |
