diff mbox series

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

Message ID 20240902-work-kmem_cache_args-v1-4-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 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 mbox series

Patch

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