Skip to content

Commit

Permalink
io_uring: Simplify the allocation of slab caches
Browse files Browse the repository at this point in the history
commit 0a31bd5 ("KMEM_CACHE(): simplify slab cache creation")
introduces a new macro.
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Link: https://lore.kernel.org/r/20240130100247.81460-1-chentao@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Kunwu Chan authored and Jens Axboe committed Feb 8, 2024
1 parent da08d2e commit a6e959b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions io_uring/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -4176,9 +4176,8 @@ static int __init io_uring_init(void)
SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU,
offsetof(struct io_kiocb, cmd.data),
sizeof_field(struct io_kiocb, cmd.data), NULL);
io_buf_cachep = kmem_cache_create("io_buffer", sizeof(struct io_buffer), 0,
SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT,
NULL);
io_buf_cachep = KMEM_CACHE(io_buffer,
SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);

#ifdef CONFIG_SYSCTL
register_sysctl_init("kernel", kernel_io_uring_disabled_table);
Expand Down

0 comments on commit a6e959b

Please sign in to comment.