linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>, Jens Axboe <axboe@kernel.dk>,
	 Jann Horn <jannh@google.com>,
	 Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-mm@kvack.org, Christian Brauner <brauner@kernel.org>
Subject: [PATCH RFC 6/6] io_uring: port to kmem_cache_setup()
Date: Mon, 02 Sep 2024 17:31:16 +0200	[thread overview]
Message-ID: <20240902-work-kmem_cache_args-v1-6-27d05bc05128@kernel.org> (raw)
In-Reply-To: <20240902-work-kmem_cache_args-v1-0-27d05bc05128@kernel.org>

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 --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);
 

-- 
2.45.2



  parent reply	other threads:[~2024-09-02 15:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 15:31 [PATCH RFC 0/6] slab: add kmem_cache_setup() Christian Brauner
2024-09-02 15:31 ` [PATCH RFC 1/6] slab: introduce kmem_cache_setup() Christian Brauner
2024-09-02 15:31 ` [PATCH RFC 2/6] slab: port KMEM_CACHE() to kmem_cache_setup() Christian Brauner
2024-09-02 15:31 ` [PATCH RFC 3/6] slab: port KMEM_CACHE_USERCOPY() " Christian Brauner
2024-09-02 15:31 ` [PATCH RFC 4/6] file: port " Christian Brauner
2024-09-02 15:31 ` [PATCH RFC 5/6] slab: remove kmem_cache_create_rcu() Christian Brauner
2024-09-02 15:31 ` Christian Brauner [this message]
2024-09-02 18:15 ` [PATCH RFC 0/6] slab: add kmem_cache_setup() Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240902-work-kmem_cache_args-v1-6-27d05bc05128@kernel.org \
    --to=brauner@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=jannh@google.com \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).