From 5d80ad9536a729fa9f3030f6fcade883a4ed4d64 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 9 Feb 2024 17:16:07 -0500 Subject: [PATCH] kernel/fork: Use per-cpu array for vma and vma locks This will allow vmas to utilize the bulk allocator and amortize the allocation time over multiple bulk allocations vs one per item. Signed-off-by: Liam R. Howlett --- kernel/fork.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index db3b9b0469ba..05e1fdd61073 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -3285,9 +3285,14 @@ void __init proc_caches_init(void) SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, NULL); - vm_area_cachep = KMEM_CACHE(vm_area_struct, SLAB_PANIC|SLAB_ACCOUNT); + vm_area_cachep = KMEM_CACHE(vm_area_struct, SLAB_PANIC|SLAB_ACCOUNT| + SLAB_NO_MERGE); + BUG_ON(kmem_cache_setup_percpu_array(vm_area_cachep, 32)); + #ifdef CONFIG_PER_VMA_LOCK - vma_lock_cachep = KMEM_CACHE(vma_lock, SLAB_PANIC|SLAB_ACCOUNT); + vma_lock_cachep = KMEM_CACHE(vma_lock, SLAB_PANIC|SLAB_ACCOUNT| + SLAB_NO_MERGE); + BUG_ON(kmem_cache_setup_percpu_array(vma_lock_cachep, 32)); #endif mmap_init(); nsproxy_cache_init(); -- 2.49.0