[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240130100247.81460-1-chentao@kylinos.cn>
Date: Tue, 30 Jan 2024 18:02:47 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: axboe@...nel.dk,
asml.silence@...il.com
Cc: io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org,
Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH] io_uring: Simplify the allocation of slab caches
commit 0a31bd5f2bbb ("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@...inos.cn>
---
io_uring/io_uring.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index cd9a137ad6ce..9a810b1169f2 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -4175,9 +4175,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);
--
2.39.2
Powered by blists - more mailing lists