]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/slab: Introduce kmem_buckets typedef
authorKees Cook <kees@kernel.org>
Mon, 1 Jul 2024 19:12:58 +0000 (12:12 -0700)
committerVlastimil Babka <vbabka@suse.cz>
Wed, 3 Jul 2024 10:24:19 +0000 (12:24 +0200)
Encapsulate the concept of a single set of kmem_caches that are used
for the kmalloc size buckets. Redefine kmalloc_caches as an array
of these buckets (for the different global cache buckets).

Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/slab.h
mm/slab_common.c

index 640cea6e6323487164d233fcedf08eb913750673..922bf15794f7d7f558b76a836310d7a335166f55 100644 (file)
@@ -426,8 +426,9 @@ enum kmalloc_cache_type {
        NR_KMALLOC_TYPES
 };
 
-extern struct kmem_cache *
-kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1];
+typedef struct kmem_cache * kmem_buckets[KMALLOC_SHIFT_HIGH + 1];
+
+extern kmem_buckets kmalloc_caches[NR_KMALLOC_TYPES];
 
 /*
  * Define gfp bits that should not be set for KMALLOC_NORMAL.
index 7272ef7bc55f6da3f54aad00bbeef763b7965599..ff60f91e4edcf855f435f9ac0238f33e2bfc321e 100644 (file)
@@ -654,8 +654,7 @@ static struct kmem_cache *__init create_kmalloc_cache(const char *name,
        return s;
 }
 
-struct kmem_cache *
-kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1] __ro_after_init =
+kmem_buckets kmalloc_caches[NR_KMALLOC_TYPES] __ro_after_init =
 { /* initialization for https://llvm.org/pr42570 */ };
 EXPORT_SYMBOL(kmalloc_caches);