From: Liam R. Howlett Date: Fri, 9 Feb 2024 22:16:07 +0000 (-0500) Subject: kernel/fork: Use per-cpu array for vma and vma locks X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5d80ad9536a729fa9f3030f6fcade883a4ed4d64;p=users%2Fjedix%2Flinux-maple.git 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 --- 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();