diff mbox series

[RFC,6/6] io_uring: port to kmem_cache_setup()

Message ID 20240902-work-kmem_cache_args-v1-6-27d05bc05128@kernel.org (mailing list archive)
State New
Headers show
Series slab: add kmem_cache_setup() | expand

Commit Message

Christian Brauner Sept. 2, 2024, 3:31 p.m. UTC
Replace kmem_cache_create_usercopy() with a call to the new
kmem_cache_setup() function.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 io_uring/io_uring.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 3942db160f18..092a43a63236 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3722,12 +3722,15 @@  static int __init io_uring_init(void)
 	 * range, and HARDENED_USERCOPY will complain if we haven't
 	 * correctly annotated this range.
 	 */
-	req_cachep = kmem_cache_create_usercopy("io_kiocb",
-				sizeof(struct io_kiocb), 0,
-				SLAB_HWCACHE_ALIGN | SLAB_PANIC |
-				SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU,
-				offsetof(struct io_kiocb, cmd.data),
-				sizeof_field(struct io_kiocb, cmd.data), NULL);
+	req_cachep = kmem_cache_setup("io_kiocb", sizeof(struct io_kiocb),
+		&(struct kmem_cache_args) {
+			.useroffset = offsetof(struct io_kiocb, cmd.data),
+			.usersize = sizeof_field(struct io_kiocb, cmd.data),
+		},
+		SLAB_HWCACHE_ALIGN |
+		SLAB_PANIC |
+		SLAB_ACCOUNT |
+		SLAB_TYPESAFE_BY_RCU);
 	io_buf_cachep = KMEM_CACHE(io_buffer,
 					  SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);