]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
slab: port KMEM_CACHE() to struct kmem_cache_args
authorChristian Brauner <brauner@kernel.org>
Thu, 5 Sep 2024 07:56:53 +0000 (09:56 +0200)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 10 Sep 2024 09:42:58 +0000 (11:42 +0200)
Make KMEM_CACHE() use struct kmem_cache_args.

Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/slab.h

index 2b8eeca7fd2cbd0a5932660527270946aee3688d..1f38d94387cc0ac8b5d21a15eeeb34e9a5c253e7 100644 (file)
@@ -284,9 +284,11 @@ int kmem_cache_shrink(struct kmem_cache *s);
  * f.e. add ____cacheline_aligned_in_smp to the struct declaration
  * then the objects will be properly aligned in SMP configurations.
  */
-#define KMEM_CACHE(__struct, __flags)                                  \
-               kmem_cache_create(#__struct, sizeof(struct __struct),   \
-                       __alignof__(struct __struct), (__flags), NULL)
+#define KMEM_CACHE(__struct, __flags)                                   \
+       __kmem_cache_create_args(#__struct, sizeof(struct __struct),    \
+                       &(struct kmem_cache_args) {                     \
+                               .align  = __alignof__(struct __struct), \
+                       }, (__flags))
 
 /*
  * To whitelist a single field for copying to/from usercopy, use this