Skip to content

Commit 72e0fe2

Browse files
keestehcaster
authored andcommitted
mm/slab: Introduce kmem_buckets typedef
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 <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent ad59baa commit 72e0fe2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/linux/slab.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,9 @@ enum kmalloc_cache_type {
426426
NR_KMALLOC_TYPES
427427
};
428428

429-
extern struct kmem_cache *
430-
kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1];
429+
typedef struct kmem_cache * kmem_buckets[KMALLOC_SHIFT_HIGH + 1];
430+
431+
extern kmem_buckets kmalloc_caches[NR_KMALLOC_TYPES];
431432

432433
/*
433434
* Define gfp bits that should not be set for KMALLOC_NORMAL.

mm/slab_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,7 @@ static struct kmem_cache *__init create_kmalloc_cache(const char *name,
654654
return s;
655655
}
656656

657-
struct kmem_cache *
658-
kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1] __ro_after_init =
657+
kmem_buckets kmalloc_caches[NR_KMALLOC_TYPES] __ro_after_init =
659658
{ /* initialization for https://llvm.org/pr42570 */ };
660659
EXPORT_SYMBOL(kmalloc_caches);
661660

0 commit comments

Comments
 (0)