* [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE instead of kmem_cache_create()
@ 2024-01-23 2:46 Kunwu Chan
2024-01-27 10:34 ` [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE() " Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Kunwu Chan @ 2024-01-23 2:46 UTC (permalink / raw)
To: pablo, kadlec, fw, davem, edumazet, kuba, pabeni
Cc: horms, netfilter-devel, coreteam, netdev, linux-kernel, Kunwu Chan
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
net/netfilter/nf_conncount.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 5d8ed6c90b7e..8715617b02fe 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -605,15 +605,11 @@ static int __init nf_conncount_modinit(void)
for (i = 0; i < CONNCOUNT_SLOTS; ++i)
spin_lock_init(&nf_conncount_locks[i]);
- conncount_conn_cachep = kmem_cache_create("nf_conncount_tuple",
- sizeof(struct nf_conncount_tuple),
- 0, 0, NULL);
+ conncount_conn_cachep = KMEM_CACHE(nf_conncount_tuple, 0);
if (!conncount_conn_cachep)
return -ENOMEM;
- conncount_rb_cachep = kmem_cache_create("nf_conncount_rb",
- sizeof(struct nf_conncount_rb),
- 0, 0, NULL);
+ conncount_rb_cachep = KMEM_CACHE(nf_conncount_rb, 0);
if (!conncount_rb_cachep) {
kmem_cache_destroy(conncount_conn_cachep);
return -ENOMEM;
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE() instead of kmem_cache_create()
2024-01-23 2:46 [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE instead of kmem_cache_create() Kunwu Chan
@ 2024-01-27 10:34 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2024-01-27 10:34 UTC (permalink / raw)
To: Kunwu Chan, coreteam, netfilter-devel, netdev, kernel-janitors,
David S. Miller, Eric Dumazet, Florian Westphal, Jakub Kicinski,
Jozsef Kadlecsik, Pablo Neira Ayuso, Paolo Abeni
Cc: LKML, Simon Horman
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
I suggest to replace the word “new” by a reference to the commit 8eb8284b412906181357c2b0110d879d5af95e52
("usercopy: Prepare for usercopy whitelisting").
See also related background information from 2017-06-10.
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-27 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 2:46 [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE instead of kmem_cache_create() Kunwu Chan
2024-01-27 10:34 ` [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE() " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®