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 4/6] file: port to kmem_cache_setup()
Date: Mon, 02 Sep 2024 17:31:14 +0200	[thread overview]
Message-ID: <20240902-work-kmem_cache_args-v1-4-27d05bc05128@kernel.org> (raw)
In-Reply-To: <20240902-work-kmem_cache_args-v1-0-27d05bc05128@kernel.org>

Replace the custom kmem_cache_create_rcu() method with a regular call to
the new kmem_cache_setup() function.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/file_table.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index 3ef558f27a1c..c20066b3f677 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -511,9 +511,15 @@ EXPORT_SYMBOL(__fput_sync);
 
 void __init files_init(void)
 {
-	filp_cachep = kmem_cache_create_rcu("filp", sizeof(struct file),
-				offsetof(struct file, f_freeptr),
-				SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
+	filp_cachep = kmem_cache_setup("filp", sizeof(struct file),
+		&(struct kmem_cache_args) {
+			.use_freeptr_offset = true,
+			.freeptr_offset = offsetof(struct file, f_freeptr),
+		},
+		SLAB_HWCACHE_ALIGN |
+		SLAB_PANIC |
+		SLAB_ACCOUNT |
+		SLAB_TYPESAFE_BY_RCU);
 	percpu_counter_init(&nr_files, 0, GFP_KERNEL);
 }
 

-- 
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 ` Christian Brauner [this message]
2024-09-02 15:31 ` [PATCH RFC 5/6] slab: remove kmem_cache_create_rcu() Christian Brauner
2024-09-02 15:31 ` [PATCH RFC 6/6] io_uring: port to kmem_cache_setup() Christian Brauner
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-4-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