All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 9p: Avoid creating multiple slab caches with the same name
@ 2024-08-07  9:47 Pedro Falcato
  2024-10-18 17:28 ` Jason Gunthorpe
  0 siblings, 1 reply; 13+ messages in thread
From: Pedro Falcato @ 2024-08-07  9:47 UTC (permalink / raw)
  To: Eric Van Hensbergen, Dominique Martinet, Christian Schoenebeck
  Cc: v9fs, linux-kernel, Pedro Falcato

In the spirit of [1], avoid creating multiple slab caches with the same
name. Instead, add the dev_name into the mix.

[1]: https://lore.kernel.org/all/20240807090746.2146479-1-pedro.falcato@gmail.com/

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
---
 net/9p/client.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index 5cd94721d97..9e7b9151816 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -979,6 +979,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
 	int err;
 	struct p9_client *clnt;
 	char *client_id;
+	char *cache_name;
 
 	clnt = kmalloc(sizeof(*clnt), GFP_KERNEL);
 	if (!clnt)
@@ -1035,15 +1036,22 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
 	if (err)
 		goto close_trans;
 
+	cache_name = kasprintf(GFP_KERNEL, "9p-fcall-cache-%s", dev_name);
+	if (!cache_name) {
+		err = -ENOMEM;
+		goto close_trans;
+	}
+
 	/* P9_HDRSZ + 4 is the smallest packet header we can have that is
 	 * followed by data accessed from userspace by read
 	 */
 	clnt->fcall_cache =
-		kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize,
+		kmem_cache_create_usercopy(cache_name, clnt->msize,
 					   0, 0, P9_HDRSZ + 4,
 					   clnt->msize - (P9_HDRSZ + 4),
 					   NULL);
 
+	kfree(cache_name);
 	return clnt;
 
 close_trans:
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-10-21 23:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07  9:47 [PATCH] 9p: Avoid creating multiple slab caches with the same name Pedro Falcato
2024-10-18 17:28 ` Jason Gunthorpe
2024-10-18 18:36   ` Pedro Falcato
2024-10-18 18:54     ` Thorsten Leemhuis
2024-10-18 21:38       ` Vlastimil Babka
2024-10-19  0:02         ` Dominique Martinet
2024-10-21  8:42           ` Vlastimil Babka
2024-10-21 18:37             ` Omar Sandoval
2024-10-21 18:57               ` Linus Torvalds
2024-10-21 20:06                 ` Omar Sandoval
2024-10-21 23:00                   ` Linus Torvalds
2024-10-21 20:18               ` Vlastimil Babka
2024-10-19  5:28         ` Linux regression tracking (Thorsten Leemhuis)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.