* [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
@ 2024-10-13 20:16 Julia Lawall
2024-10-13 20:16 ` [PATCH 01/17] wireguard: allowedips: " Julia Lawall
` (18 more replies)
0 siblings, 19 replies; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: linux-nfs
Cc: kernel-janitors, vbabka, paulmck, Tom Talpey, Dai Ngo,
Olga Kornievskaia, Neil Brown, linux-can, bridge, b.a.t.m.a.n,
linux-kernel, wireguard, netdev, ecryptfs, linux-block,
Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, linuxppc-dev, kvm, netfilter-devel, coreteam
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were done using the following Coccinelle semantic patch.
This semantic patch is designed to ignore cases where the callback
function is used in another way.
// <smpl>
#spatch --all-includes --include-headers
@r@
expression e;
local idexpression e2;
identifier cb,f,g;
position p;
@@
(
call_rcu(...,e2)
|
call_rcu(&e->f,cb@p)
|
call_rcu(&e->f.g,cb@p)
)
@r1@
type T,T1;
identifier x,r.cb;
@@
cb(...) {
(
kmem_cache_free(...);
|
T x = ...;
kmem_cache_free(...,(T1)x);
|
T x;
x = ...;
kmem_cache_free(...,(T1)x);
)
}
@s depends on r1@
position p != r.p;
identifier r.cb;
@@
cb@p
@script:ocaml@
cb << r.cb;
p << s.p;
@@
Printf.eprintf "Other use of %s at %s:%d\n" cb (List.hd p).file (List.hd p).line
@depends on r1 && !s@
expression e;
identifier r.cb,f,g;
position r.p;
@@
(
- call_rcu(&e->f,cb@p)
+ kfree_rcu(e,f)
|
- call_rcu(&e->f.g,cb@p)
+ kfree_rcu(e,f.g)
)
@r1a depends on !s@
type T,T1;
identifier x,r.cb;
@@
- cb(...) {
(
- kmem_cache_free(...);
|
- T x = ...;
- kmem_cache_free(...,(T1)x);
|
- T x;
- x = ...;
- kmem_cache_free(...,(T1)x);
)
- }
@r2 depends on !r1@
identifier r.cb;
@@
cb(...) {
...
}
@script:ocaml depends on !r1 && !r2@
cb << r.cb;
@@
Printf.eprintf "need definition for %s\n" cb
// </smpl>
---
arch/powerpc/kvm/book3s_mmu_hpte.c | 8 ------
block/blk-ioc.c | 9 ------
drivers/net/wireguard/allowedips.c | 9 +-----
fs/ecryptfs/dentry.c | 8 ------
fs/nfsd/nfs4state.c | 9 ------
kernel/time/posix-timers.c | 9 ------
net/batman-adv/translation-table.c | 47 ++----------------------------------
net/bridge/br_fdb.c | 9 ------
net/can/gw.c | 13 ++-------
net/ipv4/fib_trie.c | 8 ------
net/ipv4/inetpeer.c | 9 +-----
net/ipv6/ip6_fib.c | 9 ------
net/ipv6/xfrm6_tunnel.c | 8 ------
net/kcm/kcmsock.c | 10 -------
net/netfilter/nf_conncount.c | 10 -------
net/netfilter/nf_conntrack_expect.c | 10 -------
net/netfilter/xt_hashlimit.c | 9 ------
17 files changed, 23 insertions(+), 171 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 01/17] wireguard: allowedips: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-16 11:04 ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 02/17] ipv4: " Julia Lawall
` (17 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: Jason A. Donenfeld
Cc: kernel-janitors, vbabka, paulmck, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, wireguard, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/net/wireguard/allowedips.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c
index 4b8528206cc8..175b1ca4f66f 100644
--- a/drivers/net/wireguard/allowedips.c
+++ b/drivers/net/wireguard/allowedips.c
@@ -48,11 +48,6 @@ static void push_rcu(struct allowedips_node **stack,
}
}
-static void node_free_rcu(struct rcu_head *rcu)
-{
- kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu));
-}
-
static void root_free_rcu(struct rcu_head *rcu)
{
struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_DEPTH] = {
@@ -330,13 +325,13 @@ void wg_allowedips_remove_by_peer(struct allowedips *table,
child = rcu_dereference_protected(
parent->bit[!(node->parent_bit_packed & 1)],
lockdep_is_held(lock));
- call_rcu(&node->rcu, node_free_rcu);
+ kfree_rcu(node, rcu);
if (!free_parent)
continue;
if (child)
child->parent_bit_packed = parent->parent_bit_packed;
*(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) = child;
- call_rcu(&parent->rcu, node_free_rcu);
+ kfree_rcu(parent, rcu);
}
}
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 02/17] ipv4: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
2024-10-13 20:16 ` [PATCH 01/17] wireguard: allowedips: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-14 7:41 ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 03/17] inetpeer: " Julia Lawall
` (16 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, vbabka, paulmck, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/ipv4/fib_trie.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 09e31757e96c..161f5526b86c 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -292,15 +292,9 @@ static const int inflate_threshold = 50;
static const int halve_threshold_root = 15;
static const int inflate_threshold_root = 30;
-static void __alias_free_mem(struct rcu_head *head)
-{
- struct fib_alias *fa = container_of(head, struct fib_alias, rcu);
- kmem_cache_free(fn_alias_kmem, fa);
-}
-
static inline void alias_free_mem_rcu(struct fib_alias *fa)
{
- call_rcu(&fa->rcu, __alias_free_mem);
+ kfree_rcu(fa, rcu);
}
#define TNODE_VMALLOC_MAX \
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 03/17] inetpeer: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
2024-10-13 20:16 ` [PATCH 01/17] wireguard: allowedips: " Julia Lawall
2024-10-13 20:16 ` [PATCH 02/17] ipv4: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-14 7:42 ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 04/17] ipv6: " Julia Lawall
` (15 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, vbabka, paulmck, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/ipv4/inetpeer.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 5bd759963451..5ab56f4cb529 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -128,11 +128,6 @@ static struct inet_peer *lookup(const struct inetpeer_addr *daddr,
return NULL;
}
-static void inetpeer_free_rcu(struct rcu_head *head)
-{
- kmem_cache_free(peer_cachep, container_of(head, struct inet_peer, rcu));
-}
-
/* perform garbage collect on all items stacked during a lookup */
static void inet_peer_gc(struct inet_peer_base *base,
struct inet_peer *gc_stack[],
@@ -168,7 +163,7 @@ static void inet_peer_gc(struct inet_peer_base *base,
if (p) {
rb_erase(&p->rb_node, &base->rb_root);
base->total--;
- call_rcu(&p->rcu, inetpeer_free_rcu);
+ kfree_rcu(p, rcu);
}
}
}
@@ -242,7 +237,7 @@ void inet_putpeer(struct inet_peer *p)
WRITE_ONCE(p->dtime, (__u32)jiffies);
if (refcount_dec_and_test(&p->refcnt))
- call_rcu(&p->rcu, inetpeer_free_rcu);
+ kfree_rcu(p, rcu);
}
EXPORT_SYMBOL_GPL(inet_putpeer);
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 04/17] ipv6: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (2 preceding siblings ...)
2024-10-13 20:16 ` [PATCH 03/17] inetpeer: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-14 7:43 ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 05/17] xfrm6_tunnel: " Julia Lawall
` (14 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, vbabka, paulmck, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/ipv6/ip6_fib.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index eb111d20615c..24c57c1a52dd 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -198,16 +198,9 @@ static void node_free_immediate(struct net *net, struct fib6_node *fn)
net->ipv6.rt6_stats->fib_nodes--;
}
-static void node_free_rcu(struct rcu_head *head)
-{
- struct fib6_node *fn = container_of(head, struct fib6_node, rcu);
-
- kmem_cache_free(fib6_node_kmem, fn);
-}
-
static void node_free(struct net *net, struct fib6_node *fn)
{
- call_rcu(&fn->rcu, node_free_rcu);
+ kfree_rcu(fn, rcu);
net->ipv6.rt6_stats->fib_nodes--;
}
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 05/17] xfrm6_tunnel: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (3 preceding siblings ...)
2024-10-13 20:16 ` [PATCH 04/17] ipv6: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-16 11:05 ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 06/17] batman-adv: " Julia Lawall
` (13 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: Steffen Klassert
Cc: kernel-janitors, vbabka, paulmck, Herbert Xu, David S. Miller,
David Ahern, Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev,
linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/ipv6/xfrm6_tunnel.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index bf140ef781c1..c3c893ddb6ee 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -178,12 +178,6 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
}
EXPORT_SYMBOL(xfrm6_tunnel_alloc_spi);
-static void x6spi_destroy_rcu(struct rcu_head *head)
-{
- kmem_cache_free(xfrm6_tunnel_spi_kmem,
- container_of(head, struct xfrm6_tunnel_spi, rcu_head));
-}
-
static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr)
{
struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
@@ -200,7 +194,7 @@ static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr)
if (refcount_dec_and_test(&x6spi->refcnt)) {
hlist_del_rcu(&x6spi->list_byaddr);
hlist_del_rcu(&x6spi->list_byspi);
- call_rcu(&x6spi->rcu_head, x6spi_destroy_rcu);
+ kfree_rcu(x6spi, rcu_head);
break;
}
}
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (4 preceding siblings ...)
2024-10-13 20:16 ` [PATCH 05/17] xfrm6_tunnel: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-14 7:03 ` Sven Eckelmann
2024-10-14 8:03 ` Sven Eckelmann
2024-10-13 20:16 ` [PATCH 08/17] net: bridge: " Julia Lawall
` (12 subsequent siblings)
18 siblings, 2 replies; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: Marek Lindner
Cc: kernel-janitors, vbabka, paulmck, Simon Wunderlich,
Antonio Quartulli, Sven Eckelmann, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, b.a.t.m.a.n, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/batman-adv/translation-table.c | 47 ++-----------------------------------
1 file changed, 3 insertions(+), 44 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 2243cec18ecc..b21ff3c36b07 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -208,20 +208,6 @@ batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
return tt_global_entry;
}
-/**
- * batadv_tt_local_entry_free_rcu() - free the tt_local_entry
- * @rcu: rcu pointer of the tt_local_entry
- */
-static void batadv_tt_local_entry_free_rcu(struct rcu_head *rcu)
-{
- struct batadv_tt_local_entry *tt_local_entry;
-
- tt_local_entry = container_of(rcu, struct batadv_tt_local_entry,
- common.rcu);
-
- kmem_cache_free(batadv_tl_cache, tt_local_entry);
-}
-
/**
* batadv_tt_local_entry_release() - release tt_local_entry from lists and queue
* for free after rcu grace period
@@ -236,7 +222,7 @@ static void batadv_tt_local_entry_release(struct kref *ref)
batadv_softif_vlan_put(tt_local_entry->vlan);
- call_rcu(&tt_local_entry->common.rcu, batadv_tt_local_entry_free_rcu);
+ kfree_rcu(tt_local_entry, common.rcu);
}
/**
@@ -254,20 +240,6 @@ batadv_tt_local_entry_put(struct batadv_tt_local_entry *tt_local_entry)
batadv_tt_local_entry_release);
}
-/**
- * batadv_tt_global_entry_free_rcu() - free the tt_global_entry
- * @rcu: rcu pointer of the tt_global_entry
- */
-static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu)
-{
- struct batadv_tt_global_entry *tt_global_entry;
-
- tt_global_entry = container_of(rcu, struct batadv_tt_global_entry,
- common.rcu);
-
- kmem_cache_free(batadv_tg_cache, tt_global_entry);
-}
-
/**
* batadv_tt_global_entry_release() - release tt_global_entry from lists and
* queue for free after rcu grace period
@@ -282,7 +254,7 @@ void batadv_tt_global_entry_release(struct kref *ref)
batadv_tt_global_del_orig_list(tt_global_entry);
- call_rcu(&tt_global_entry->common.rcu, batadv_tt_global_entry_free_rcu);
+ kfree_rcu(tt_global_entry, common.rcu);
}
/**
@@ -407,19 +379,6 @@ static void batadv_tt_global_size_dec(struct batadv_orig_node *orig_node,
batadv_tt_global_size_mod(orig_node, vid, -1);
}
-/**
- * batadv_tt_orig_list_entry_free_rcu() - free the orig_entry
- * @rcu: rcu pointer of the orig_entry
- */
-static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
-{
- struct batadv_tt_orig_list_entry *orig_entry;
-
- orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu);
-
- kmem_cache_free(batadv_tt_orig_cache, orig_entry);
-}
-
/**
* batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
* queue for free after rcu grace period
@@ -433,7 +392,7 @@ static void batadv_tt_orig_list_entry_release(struct kref *ref)
refcount);
batadv_orig_node_put(orig_entry->orig_node);
- call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
+ kfree_rcu(orig_entry, rcu);
}
/**
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 08/17] net: bridge: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (5 preceding siblings ...)
2024-10-13 20:16 ` [PATCH 06/17] batman-adv: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-14 7:04 ` Nikolay Aleksandrov
2024-10-16 11:07 ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 10/17] can: gw: " Julia Lawall
` (11 subsequent siblings)
18 siblings, 2 replies; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: Roopa Prabhu
Cc: kernel-janitors, vbabka, paulmck, Nikolay Aleksandrov,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
bridge, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/bridge/br_fdb.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 642b8ccaae8e..1cd7bade9b3b 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -73,13 +73,6 @@ static inline int has_expired(const struct net_bridge *br,
time_before_eq(fdb->updated + hold_time(br), jiffies);
}
-static void fdb_rcu_free(struct rcu_head *head)
-{
- struct net_bridge_fdb_entry *ent
- = container_of(head, struct net_bridge_fdb_entry, rcu);
- kmem_cache_free(br_fdb_cache, ent);
-}
-
static int fdb_to_nud(const struct net_bridge *br,
const struct net_bridge_fdb_entry *fdb)
{
@@ -329,7 +322,7 @@ static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f,
if (test_and_clear_bit(BR_FDB_DYNAMIC_LEARNED, &f->flags))
atomic_dec(&br->fdb_n_learned);
fdb_notify(br, f, RTM_DELNEIGH, swdev_notify);
- call_rcu(&f->rcu, fdb_rcu_free);
+ kfree_rcu(f, rcu);
}
/* Delete a local entry if no other port had the same address.
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 10/17] can: gw: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (6 preceding siblings ...)
2024-10-13 20:16 ` [PATCH 08/17] net: bridge: " Julia Lawall
@ 2024-10-13 20:16 ` Julia Lawall
2024-10-14 3:03 ` Vincent MAILHOL
2024-10-13 20:17 ` [PATCH 14/17] kcm: " Julia Lawall
` (10 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:16 UTC (permalink / raw)
To: Oliver Hartkopp
Cc: kernel-janitors, vbabka, paulmck, Marc Kleine-Budde,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-can, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/can/gw.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/net/can/gw.c b/net/can/gw.c
index 37528826935e..ffb9870e2d01 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -577,13 +577,6 @@ static inline void cgw_unregister_filter(struct net *net, struct cgw_job *gwj)
gwj->ccgw.filter.can_mask, can_can_gw_rcv, gwj);
}
-static void cgw_job_free_rcu(struct rcu_head *rcu_head)
-{
- struct cgw_job *gwj = container_of(rcu_head, struct cgw_job, rcu);
-
- kmem_cache_free(cgw_cache, gwj);
-}
-
static int cgw_notifier(struct notifier_block *nb,
unsigned long msg, void *ptr)
{
@@ -603,7 +596,7 @@ static int cgw_notifier(struct notifier_block *nb,
if (gwj->src.dev == dev || gwj->dst.dev == dev) {
hlist_del(&gwj->list);
cgw_unregister_filter(net, gwj);
- call_rcu(&gwj->rcu, cgw_job_free_rcu);
+ kfree_rcu(gwj, rcu);
}
}
}
@@ -1168,7 +1161,7 @@ static void cgw_remove_all_jobs(struct net *net)
hlist_for_each_entry_safe(gwj, nx, &net->can.cgw_list, list) {
hlist_del(&gwj->list);
cgw_unregister_filter(net, gwj);
- call_rcu(&gwj->rcu, cgw_job_free_rcu);
+ kfree_rcu(gwj, rcu);
}
}
@@ -1236,7 +1229,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh,
hlist_del(&gwj->list);
cgw_unregister_filter(net, gwj);
- call_rcu(&gwj->rcu, cgw_job_free_rcu);
+ kfree_rcu(gwj, rcu);
err = 0;
break;
}
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 14/17] kcm: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (7 preceding siblings ...)
2024-10-13 20:16 ` [PATCH 10/17] can: gw: " Julia Lawall
@ 2024-10-13 20:17 ` Julia Lawall
2024-10-16 12:16 ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 15/17] netfilter: nf_conncount: " Julia Lawall
` (9 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:17 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, vbabka, paulmck, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/kcm/kcmsock.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index d4118c796290..24aec295a51c 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -1584,14 +1584,6 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return err;
}
-static void free_mux(struct rcu_head *rcu)
-{
- struct kcm_mux *mux = container_of(rcu,
- struct kcm_mux, rcu);
-
- kmem_cache_free(kcm_muxp, mux);
-}
-
static void release_mux(struct kcm_mux *mux)
{
struct kcm_net *knet = mux->knet;
@@ -1619,7 +1611,7 @@ static void release_mux(struct kcm_mux *mux)
knet->count--;
mutex_unlock(&knet->mutex);
- call_rcu(&mux->rcu, free_mux);
+ kfree_rcu(mux, rcu);
}
static void kcm_done(struct kcm_sock *kcm)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 15/17] netfilter: nf_conncount: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (8 preceding siblings ...)
2024-10-13 20:17 ` [PATCH 14/17] kcm: " Julia Lawall
@ 2024-10-13 20:17 ` Julia Lawall
2024-10-16 12:18 ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 16/17] netfilter: expect: " Julia Lawall
` (8 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:17 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: kernel-janitors, vbabka, paulmck, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netfilter-devel, coreteam, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/netfilter/nf_conncount.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 4890af4dc263..6a7a6c2d6ebc 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -275,14 +275,6 @@ bool nf_conncount_gc_list(struct net *net,
}
EXPORT_SYMBOL_GPL(nf_conncount_gc_list);
-static void __tree_nodes_free(struct rcu_head *h)
-{
- struct nf_conncount_rb *rbconn;
-
- rbconn = container_of(h, struct nf_conncount_rb, rcu_head);
- kmem_cache_free(conncount_rb_cachep, rbconn);
-}
-
/* caller must hold tree nf_conncount_locks[] lock */
static void tree_nodes_free(struct rb_root *root,
struct nf_conncount_rb *gc_nodes[],
@@ -295,7 +287,7 @@ static void tree_nodes_free(struct rb_root *root,
spin_lock(&rbconn->list.list_lock);
if (!rbconn->list.count) {
rb_erase(&rbconn->node, root);
- call_rcu(&rbconn->rcu_head, __tree_nodes_free);
+ kfree_rcu(rbconn, rcu_head);
}
spin_unlock(&rbconn->list.list_lock);
}
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 16/17] netfilter: expect: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (9 preceding siblings ...)
2024-10-13 20:17 ` [PATCH 15/17] netfilter: nf_conncount: " Julia Lawall
@ 2024-10-13 20:17 ` Julia Lawall
2024-10-16 12:18 ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 17/17] netfilter: xt_hashlimit: " Julia Lawall
` (7 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:17 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: kernel-janitors, vbabka, paulmck, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netfilter-devel, coreteam, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/netfilter/nf_conntrack_expect.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 21fa550966f0..9dcaef6f3663 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -367,18 +367,10 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,
}
EXPORT_SYMBOL_GPL(nf_ct_expect_init);
-static void nf_ct_expect_free_rcu(struct rcu_head *head)
-{
- struct nf_conntrack_expect *exp;
-
- exp = container_of(head, struct nf_conntrack_expect, rcu);
- kmem_cache_free(nf_ct_expect_cachep, exp);
-}
-
void nf_ct_expect_put(struct nf_conntrack_expect *exp)
{
if (refcount_dec_and_test(&exp->use))
- call_rcu(&exp->rcu, nf_ct_expect_free_rcu);
+ kfree_rcu(exp, rcu);
}
EXPORT_SYMBOL_GPL(nf_ct_expect_put);
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 17/17] netfilter: xt_hashlimit: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (10 preceding siblings ...)
2024-10-13 20:17 ` [PATCH 16/17] netfilter: expect: " Julia Lawall
@ 2024-10-13 20:17 ` Julia Lawall
2024-10-16 12:19 ` Uladzislau Rezki
2024-10-13 20:53 ` (subset) [PATCH 00/17] " Jens Axboe
` (6 subsequent siblings)
18 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-13 20:17 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: kernel-janitors, vbabka, paulmck, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netfilter-devel, coreteam, netdev, linux-kernel
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
net/netfilter/xt_hashlimit.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 0859b8f76764..c2b9b954eb53 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -256,18 +256,11 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
return ent;
}
-static void dsthash_free_rcu(struct rcu_head *head)
-{
- struct dsthash_ent *ent = container_of(head, struct dsthash_ent, rcu);
-
- kmem_cache_free(hashlimit_cachep, ent);
-}
-
static inline void
dsthash_free(struct xt_hashlimit_htable *ht, struct dsthash_ent *ent)
{
hlist_del_rcu(&ent->node);
- call_rcu(&ent->rcu, dsthash_free_rcu);
+ kfree_rcu(ent, rcu);
ht->count--;
}
static void htable_gc(struct work_struct *work);
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (11 preceding siblings ...)
2024-10-13 20:17 ` [PATCH 17/17] netfilter: xt_hashlimit: " Julia Lawall
@ 2024-10-13 20:53 ` Jens Axboe
2024-10-14 0:31 ` Paul E. McKenney
` (5 subsequent siblings)
18 siblings, 0 replies; 36+ messages in thread
From: Jens Axboe @ 2024-10-13 20:53 UTC (permalink / raw)
To: linux-nfs, Julia Lawall
Cc: kernel-janitors, vbabka, paulmck, Tom Talpey, Dai Ngo,
Olga Kornievskaia, Neil Brown, linux-can, bridge, b.a.t.m.a.n,
linux-kernel, wireguard, netdev, ecryptfs, linux-block,
Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, linuxppc-dev, kvm, netfilter-devel, coreteam
On Sun, 13 Oct 2024 22:16:47 +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were done using the following Coccinelle semantic patch.
> This semantic patch is designed to ignore cases where the callback
> function is used in another way.
>
> [...]
Applied, thanks!
[09/17] block: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
commit: 7a9b197adbafa9d6d1a79a0633607b78b1adef82
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (12 preceding siblings ...)
2024-10-13 20:53 ` (subset) [PATCH 00/17] " Jens Axboe
@ 2024-10-14 0:31 ` Paul E. McKenney
2024-10-14 7:23 ` Vlastimil Babka
` (4 subsequent siblings)
18 siblings, 0 replies; 36+ messages in thread
From: Paul E. McKenney @ 2024-10-14 0:31 UTC (permalink / raw)
To: Julia Lawall
Cc: linux-nfs, kernel-janitors, vbabka, Tom Talpey, Dai Ngo,
Olga Kornievskaia, Neil Brown, linux-can, bridge, b.a.t.m.a.n,
linux-kernel, wireguard, netdev, ecryptfs, linux-block,
Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, linuxppc-dev, kvm, netfilter-devel, coreteam
On Sun, Oct 13, 2024 at 10:16:47PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were done using the following Coccinelle semantic patch.
> This semantic patch is designed to ignore cases where the callback
> function is used in another way.
For the series:
Acked-by: Paul E. McKenney <paulmck@kernel.org>
> // <smpl>
> #spatch --all-includes --include-headers
>
> @r@
> expression e;
> local idexpression e2;
> identifier cb,f,g;
> position p;
> @@
>
> (
> call_rcu(...,e2)
> |
> call_rcu(&e->f,cb@p)
> |
> call_rcu(&e->f.g,cb@p)
> )
>
> @r1@
> type T,T1;
> identifier x,r.cb;
> @@
>
> cb(...) {
> (
> kmem_cache_free(...);
> |
> T x = ...;
> kmem_cache_free(...,(T1)x);
> |
> T x;
> x = ...;
> kmem_cache_free(...,(T1)x);
> )
> }
>
> @s depends on r1@
> position p != r.p;
> identifier r.cb;
> @@
>
> cb@p
>
> @script:ocaml@
> cb << r.cb;
> p << s.p;
> @@
>
> Printf.eprintf "Other use of %s at %s:%d\n" cb (List.hd p).file (List.hd p).line
>
> @depends on r1 && !s@
> expression e;
> identifier r.cb,f,g;
> position r.p;
> @@
>
> (
> - call_rcu(&e->f,cb@p)
> + kfree_rcu(e,f)
> |
> - call_rcu(&e->f.g,cb@p)
> + kfree_rcu(e,f.g)
> )
>
> @r1a depends on !s@
> type T,T1;
> identifier x,r.cb;
> @@
>
> - cb(...) {
> (
> - kmem_cache_free(...);
> |
> - T x = ...;
> - kmem_cache_free(...,(T1)x);
> |
> - T x;
> - x = ...;
> - kmem_cache_free(...,(T1)x);
> )
> - }
>
> @r2 depends on !r1@
> identifier r.cb;
> @@
>
> cb(...) {
> ...
> }
>
> @script:ocaml depends on !r1 && !r2@
> cb << r.cb;
> @@
>
> Printf.eprintf "need definition for %s\n" cb
> // </smpl>
>
> ---
>
> arch/powerpc/kvm/book3s_mmu_hpte.c | 8 ------
> block/blk-ioc.c | 9 ------
> drivers/net/wireguard/allowedips.c | 9 +-----
> fs/ecryptfs/dentry.c | 8 ------
> fs/nfsd/nfs4state.c | 9 ------
> kernel/time/posix-timers.c | 9 ------
> net/batman-adv/translation-table.c | 47 ++----------------------------------
> net/bridge/br_fdb.c | 9 ------
> net/can/gw.c | 13 ++-------
> net/ipv4/fib_trie.c | 8 ------
> net/ipv4/inetpeer.c | 9 +-----
> net/ipv6/ip6_fib.c | 9 ------
> net/ipv6/xfrm6_tunnel.c | 8 ------
> net/kcm/kcmsock.c | 10 -------
> net/netfilter/nf_conncount.c | 10 -------
> net/netfilter/nf_conntrack_expect.c | 10 -------
> net/netfilter/xt_hashlimit.c | 9 ------
> 17 files changed, 23 insertions(+), 171 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 10/17] can: gw: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 10/17] can: gw: " Julia Lawall
@ 2024-10-14 3:03 ` Vincent MAILHOL
0 siblings, 0 replies; 36+ messages in thread
From: Vincent MAILHOL @ 2024-10-14 3:03 UTC (permalink / raw)
To: Julia Lawall
Cc: Oliver Hartkopp, kernel-janitors, vbabka, Paul E . McKenney,
Marc Kleine-Budde, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-can, netdev, open list
Hi Julia,
Thanks for the patch.
On Mon. 14 Oct. 2024, 05:21, Julia Lawall <Julia.Lawall@inria.fr> wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 06/17] batman-adv: " Julia Lawall
@ 2024-10-14 7:03 ` Sven Eckelmann
2024-10-14 7:08 ` Julia Lawall
2024-10-14 8:03 ` Sven Eckelmann
1 sibling, 1 reply; 36+ messages in thread
From: Sven Eckelmann @ 2024-10-14 7:03 UTC (permalink / raw)
To: Julia Lawall, vbabka, linus.luessing
Cc: Marek Lindner, kernel-janitors, paulmck, Simon Wunderlich,
Antonio Quartulli, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, b.a.t.m.a.n, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4045 bytes --]
On Sunday, 13 October 2024 22:16:53 CEST Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/batman-adv/translation-table.c | 47 ++-----------------------------------
> 1 file changed, 3 insertions(+), 44 deletions(-)
This was tried and we noticed that it is not safe [1]. So, I would get
confirmation that commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier()
from kmem_cache_destroy()") is fixing the problem which we had at that time.
The commit message sounds like it but I just want to be sure.
Kind regards,
Sven
[1] https://lore.kernel.org/r/20240612133357.2596-1-linus.luessing@c0d3.blue
>
> diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> index 2243cec18ecc..b21ff3c36b07 100644
> --- a/net/batman-adv/translation-table.c
> +++ b/net/batman-adv/translation-table.c
> @@ -208,20 +208,6 @@ batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
> return tt_global_entry;
> }
>
> -/**
> - * batadv_tt_local_entry_free_rcu() - free the tt_local_entry
> - * @rcu: rcu pointer of the tt_local_entry
> - */
> -static void batadv_tt_local_entry_free_rcu(struct rcu_head *rcu)
> -{
> - struct batadv_tt_local_entry *tt_local_entry;
> -
> - tt_local_entry = container_of(rcu, struct batadv_tt_local_entry,
> - common.rcu);
> -
> - kmem_cache_free(batadv_tl_cache, tt_local_entry);
> -}
> -
> /**
> * batadv_tt_local_entry_release() - release tt_local_entry from lists and queue
> * for free after rcu grace period
> @@ -236,7 +222,7 @@ static void batadv_tt_local_entry_release(struct kref *ref)
>
> batadv_softif_vlan_put(tt_local_entry->vlan);
>
> - call_rcu(&tt_local_entry->common.rcu, batadv_tt_local_entry_free_rcu);
> + kfree_rcu(tt_local_entry, common.rcu);
> }
>
> /**
> @@ -254,20 +240,6 @@ batadv_tt_local_entry_put(struct batadv_tt_local_entry *tt_local_entry)
> batadv_tt_local_entry_release);
> }
>
> -/**
> - * batadv_tt_global_entry_free_rcu() - free the tt_global_entry
> - * @rcu: rcu pointer of the tt_global_entry
> - */
> -static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu)
> -{
> - struct batadv_tt_global_entry *tt_global_entry;
> -
> - tt_global_entry = container_of(rcu, struct batadv_tt_global_entry,
> - common.rcu);
> -
> - kmem_cache_free(batadv_tg_cache, tt_global_entry);
> -}
> -
> /**
> * batadv_tt_global_entry_release() - release tt_global_entry from lists and
> * queue for free after rcu grace period
> @@ -282,7 +254,7 @@ void batadv_tt_global_entry_release(struct kref *ref)
>
> batadv_tt_global_del_orig_list(tt_global_entry);
>
> - call_rcu(&tt_global_entry->common.rcu, batadv_tt_global_entry_free_rcu);
> + kfree_rcu(tt_global_entry, common.rcu);
> }
>
> /**
> @@ -407,19 +379,6 @@ static void batadv_tt_global_size_dec(struct batadv_orig_node *orig_node,
> batadv_tt_global_size_mod(orig_node, vid, -1);
> }
>
> -/**
> - * batadv_tt_orig_list_entry_free_rcu() - free the orig_entry
> - * @rcu: rcu pointer of the orig_entry
> - */
> -static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
> -{
> - struct batadv_tt_orig_list_entry *orig_entry;
> -
> - orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu);
> -
> - kmem_cache_free(batadv_tt_orig_cache, orig_entry);
> -}
> -
> /**
> * batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
> * queue for free after rcu grace period
> @@ -433,7 +392,7 @@ static void batadv_tt_orig_list_entry_release(struct kref *ref)
> refcount);
>
> batadv_orig_node_put(orig_entry->orig_node);
> - call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
> + kfree_rcu(orig_entry, rcu);
> }
>
> /**
>
>
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 08/17] net: bridge: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 08/17] net: bridge: " Julia Lawall
@ 2024-10-14 7:04 ` Nikolay Aleksandrov
2024-10-16 11:07 ` Uladzislau Rezki
1 sibling, 0 replies; 36+ messages in thread
From: Nikolay Aleksandrov @ 2024-10-14 7:04 UTC (permalink / raw)
To: Julia Lawall, Roopa Prabhu
Cc: kernel-janitors, vbabka, paulmck, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, bridge, netdev, linux-kernel
On 13/10/2024 23:16, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/bridge/br_fdb.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 642b8ccaae8e..1cd7bade9b3b 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -73,13 +73,6 @@ static inline int has_expired(const struct net_bridge *br,
> time_before_eq(fdb->updated + hold_time(br), jiffies);
> }
>
> -static void fdb_rcu_free(struct rcu_head *head)
> -{
> - struct net_bridge_fdb_entry *ent
> - = container_of(head, struct net_bridge_fdb_entry, rcu);
> - kmem_cache_free(br_fdb_cache, ent);
> -}
> -
> static int fdb_to_nud(const struct net_bridge *br,
> const struct net_bridge_fdb_entry *fdb)
> {
> @@ -329,7 +322,7 @@ static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f,
> if (test_and_clear_bit(BR_FDB_DYNAMIC_LEARNED, &f->flags))
> atomic_dec(&br->fdb_n_learned);
> fdb_notify(br, f, RTM_DELNEIGH, swdev_notify);
> - call_rcu(&f->rcu, fdb_rcu_free);
> + kfree_rcu(f, rcu);
> }
>
> /* Delete a local entry if no other port had the same address.
>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-14 7:03 ` Sven Eckelmann
@ 2024-10-14 7:08 ` Julia Lawall
2024-10-14 7:19 ` Vlastimil Babka
0 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2024-10-14 7:08 UTC (permalink / raw)
To: Sven Eckelmann
Cc: Julia Lawall, vbabka, linus.luessing, Marek Lindner,
kernel-janitors, paulmck, Simon Wunderlich, Antonio Quartulli,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
b.a.t.m.a.n, netdev, linux-kernel
On Mon, 14 Oct 2024, Sven Eckelmann wrote:
> On Sunday, 13 October 2024 22:16:53 CEST Julia Lawall wrote:
> > Since SLOB was removed and since
> > commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> > it is not necessary to use call_rcu when the callback only performs
> > kmem_cache_free. Use kfree_rcu() directly.
> >
> > The changes were made using Coccinelle.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> >
> > ---
> > net/batman-adv/translation-table.c | 47 ++-----------------------------------
> > 1 file changed, 3 insertions(+), 44 deletions(-)
>
>
> This was tried and we noticed that it is not safe [1]. So, I would get
> confirmation that commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier()
> from kmem_cache_destroy()") is fixing the problem which we had at that time.
> The commit message sounds like it but I just want to be sure.
Thanks for the feedback. I think that Vlastimil Babka can help with that.
julia
>
> Kind regards,
> Sven
>
> [1] https://lore.kernel.org/r/20240612133357.2596-1-linus.luessing@c0d3.blue
>
> >
> > diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> > index 2243cec18ecc..b21ff3c36b07 100644
> > --- a/net/batman-adv/translation-table.c
> > +++ b/net/batman-adv/translation-table.c
> > @@ -208,20 +208,6 @@ batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
> > return tt_global_entry;
> > }
> >
> > -/**
> > - * batadv_tt_local_entry_free_rcu() - free the tt_local_entry
> > - * @rcu: rcu pointer of the tt_local_entry
> > - */
> > -static void batadv_tt_local_entry_free_rcu(struct rcu_head *rcu)
> > -{
> > - struct batadv_tt_local_entry *tt_local_entry;
> > -
> > - tt_local_entry = container_of(rcu, struct batadv_tt_local_entry,
> > - common.rcu);
> > -
> > - kmem_cache_free(batadv_tl_cache, tt_local_entry);
> > -}
> > -
> > /**
> > * batadv_tt_local_entry_release() - release tt_local_entry from lists and queue
> > * for free after rcu grace period
> > @@ -236,7 +222,7 @@ static void batadv_tt_local_entry_release(struct kref *ref)
> >
> > batadv_softif_vlan_put(tt_local_entry->vlan);
> >
> > - call_rcu(&tt_local_entry->common.rcu, batadv_tt_local_entry_free_rcu);
> > + kfree_rcu(tt_local_entry, common.rcu);
> > }
> >
> > /**
> > @@ -254,20 +240,6 @@ batadv_tt_local_entry_put(struct batadv_tt_local_entry *tt_local_entry)
> > batadv_tt_local_entry_release);
> > }
> >
> > -/**
> > - * batadv_tt_global_entry_free_rcu() - free the tt_global_entry
> > - * @rcu: rcu pointer of the tt_global_entry
> > - */
> > -static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu)
> > -{
> > - struct batadv_tt_global_entry *tt_global_entry;
> > -
> > - tt_global_entry = container_of(rcu, struct batadv_tt_global_entry,
> > - common.rcu);
> > -
> > - kmem_cache_free(batadv_tg_cache, tt_global_entry);
> > -}
> > -
> > /**
> > * batadv_tt_global_entry_release() - release tt_global_entry from lists and
> > * queue for free after rcu grace period
> > @@ -282,7 +254,7 @@ void batadv_tt_global_entry_release(struct kref *ref)
> >
> > batadv_tt_global_del_orig_list(tt_global_entry);
> >
> > - call_rcu(&tt_global_entry->common.rcu, batadv_tt_global_entry_free_rcu);
> > + kfree_rcu(tt_global_entry, common.rcu);
> > }
> >
> > /**
> > @@ -407,19 +379,6 @@ static void batadv_tt_global_size_dec(struct batadv_orig_node *orig_node,
> > batadv_tt_global_size_mod(orig_node, vid, -1);
> > }
> >
> > -/**
> > - * batadv_tt_orig_list_entry_free_rcu() - free the orig_entry
> > - * @rcu: rcu pointer of the orig_entry
> > - */
> > -static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
> > -{
> > - struct batadv_tt_orig_list_entry *orig_entry;
> > -
> > - orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu);
> > -
> > - kmem_cache_free(batadv_tt_orig_cache, orig_entry);
> > -}
> > -
> > /**
> > * batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
> > * queue for free after rcu grace period
> > @@ -433,7 +392,7 @@ static void batadv_tt_orig_list_entry_release(struct kref *ref)
> > refcount);
> >
> > batadv_orig_node_put(orig_entry->orig_node);
> > - call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
> > + kfree_rcu(orig_entry, rcu);
> > }
> >
> > /**
> >
> >
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-14 7:08 ` Julia Lawall
@ 2024-10-14 7:19 ` Vlastimil Babka
0 siblings, 0 replies; 36+ messages in thread
From: Vlastimil Babka @ 2024-10-14 7:19 UTC (permalink / raw)
To: Julia Lawall, Sven Eckelmann
Cc: linus.luessing, Marek Lindner, kernel-janitors, paulmck,
Simon Wunderlich, Antonio Quartulli, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, b.a.t.m.a.n, netdev,
linux-kernel
On 10/14/24 09:08, Julia Lawall wrote:
>
>
> On Mon, 14 Oct 2024, Sven Eckelmann wrote:
>
>> On Sunday, 13 October 2024 22:16:53 CEST Julia Lawall wrote:
>> > Since SLOB was removed and since
>> > commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
>> > it is not necessary to use call_rcu when the callback only performs
>> > kmem_cache_free. Use kfree_rcu() directly.
>> >
>> > The changes were made using Coccinelle.
>> >
>> > Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>> >
>> > ---
>> > net/batman-adv/translation-table.c | 47 ++-----------------------------------
>> > 1 file changed, 3 insertions(+), 44 deletions(-)
>>
>>
>> This was tried and we noticed that it is not safe [1]. So, I would get
>> confirmation that commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier()
>> from kmem_cache_destroy()") is fixing the problem which we had at that time.
>> The commit message sounds like it but I just want to be sure.
>
> Thanks for the feedback. I think that Vlastimil Babka can help with that.
Hi, yeah the batman-adv issue was how we learned about the problem and the
series of commits leading to and including 6c6c47b063b5 was done exactly to
address the kmem_cache_destroy() on module unload issue, and unblock the
conversion to kfree_rcu().
Thanks, Vlastimil
> julia
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (13 preceding siblings ...)
2024-10-14 0:31 ` Paul E. McKenney
@ 2024-10-14 7:23 ` Vlastimil Babka
2024-10-14 11:26 ` Pablo Neira Ayuso
` (3 subsequent siblings)
18 siblings, 0 replies; 36+ messages in thread
From: Vlastimil Babka @ 2024-10-14 7:23 UTC (permalink / raw)
To: Julia Lawall, linux-nfs
Cc: kernel-janitors, paulmck, Tom Talpey, Dai Ngo, Olga Kornievskaia,
Neil Brown, linux-can, bridge, b.a.t.m.a.n, linux-kernel,
wireguard, netdev, ecryptfs, linux-block, Nicholas Piggin,
Christophe Leroy, Naveen N Rao, Madhavan Srinivasan, linuxppc-dev,
kvm, netfilter-devel, coreteam
On 10/13/24 22:16, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were done using the following Coccinelle semantic patch.
> This semantic patch is designed to ignore cases where the callback
> function is used in another way.
Thanks, LGTM!
For the series:
Acked-by: Vlastimil Babka <vbabka@suse.cz>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 02/17] ipv4: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 02/17] ipv4: " Julia Lawall
@ 2024-10-14 7:41 ` Eric Dumazet
0 siblings, 0 replies; 36+ messages in thread
From: Eric Dumazet @ 2024-10-14 7:41 UTC (permalink / raw)
To: Julia Lawall
Cc: David S. Miller, kernel-janitors, vbabka, paulmck, David Ahern,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:18 PM Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Note that fn_alias_kmem is never destroyed, so commit 6c6c47b063b5
seems not relevant.
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 03/17] inetpeer: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 03/17] inetpeer: " Julia Lawall
@ 2024-10-14 7:42 ` Eric Dumazet
0 siblings, 0 replies; 36+ messages in thread
From: Eric Dumazet @ 2024-10-14 7:42 UTC (permalink / raw)
To: Julia Lawall
Cc: David S. Miller, kernel-janitors, vbabka, paulmck, David Ahern,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:18 PM Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 04/17] ipv6: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 04/17] ipv6: " Julia Lawall
@ 2024-10-14 7:43 ` Eric Dumazet
0 siblings, 0 replies; 36+ messages in thread
From: Eric Dumazet @ 2024-10-14 7:43 UTC (permalink / raw)
To: Julia Lawall
Cc: David S. Miller, kernel-janitors, vbabka, paulmck, David Ahern,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:18 PM Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 06/17] batman-adv: " Julia Lawall
2024-10-14 7:03 ` Sven Eckelmann
@ 2024-10-14 8:03 ` Sven Eckelmann
1 sibling, 0 replies; 36+ messages in thread
From: Sven Eckelmann @ 2024-10-14 8:03 UTC (permalink / raw)
To: Marek Lindner, Julia Lawall
Cc: Sven Eckelmann, kernel-janitors, vbabka, paulmck,
Antonio Quartulli, Simon Wunderlich, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, b.a.t.m.a.n, netdev,
linux-kernel
On Sun, 13 Oct 2024 22:16:53 +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> [...]
Applied, thanks!
[06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
commit: 356c81b6c494a359ed6e25087931acc78c518fb9
Best regards,
--
Sven Eckelmann <sven@narfation.org>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (14 preceding siblings ...)
2024-10-14 7:23 ` Vlastimil Babka
@ 2024-10-14 11:26 ` Pablo Neira Ayuso
2024-10-15 13:40 ` patchwork-bot+netdevbpf
` (2 subsequent siblings)
18 siblings, 0 replies; 36+ messages in thread
From: Pablo Neira Ayuso @ 2024-10-14 11:26 UTC (permalink / raw)
To: Julia Lawall
Cc: linux-nfs, kernel-janitors, vbabka, paulmck, Tom Talpey, Dai Ngo,
Olga Kornievskaia, Neil Brown, linux-can, bridge, b.a.t.m.a.n,
linux-kernel, wireguard, netdev, ecryptfs, linux-block,
Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, linuxppc-dev, kvm, netfilter-devel, coreteam
On Sun, Oct 13, 2024 at 10:16:47PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
Applied and squashed into single patch for netfilter these patches:
[17/17] netfilter: xt_hashlimit: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
[16/17] netfilter: expect: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
[15/17] netfilter: nf_conncount: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
this update is now flying to net-next.
Thanks
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (15 preceding siblings ...)
2024-10-14 11:26 ` Pablo Neira Ayuso
@ 2024-10-15 13:40 ` patchwork-bot+netdevbpf
2024-10-15 18:00 ` patchwork-bot+netdevbpf
2024-11-17 11:56 ` (subset) " Michael Ellerman
18 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-15 13:40 UTC (permalink / raw)
To: Julia Lawall
Cc: linux-nfs, kernel-janitors, vbabka, paulmck, tom, Dai.Ngo,
okorniev, neilb, linux-can, bridge, b.a.t.m.a.n, linux-kernel,
wireguard, netdev, ecryptfs, linux-block, npiggin,
christophe.leroy, naveen, maddy, linuxppc-dev, kvm,
netfilter-devel, coreteam
Hello:
This series was applied to netdev/net-next.git (main)
by Simon Wunderlich <sw@simonwunderlich.de>:
On Sun, 13 Oct 2024 22:16:47 +0200 you wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were done using the following Coccinelle semantic patch.
> This semantic patch is designed to ignore cases where the callback
> function is used in another way.
>
> [...]
Here is the summary with links:
- [01/17] wireguard: allowedips: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [02/17] ipv4: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [03/17] inetpeer: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [04/17] ipv6: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [05/17] xfrm6_tunnel: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/netdev/net-next/c/356c81b6c494
- [08/17] net: bridge: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [10/17] can: gw: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [14/17] kcm: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [15/17] netfilter: nf_conncount: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [16/17] netfilter: expect: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [17/17] netfilter: xt_hashlimit: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (16 preceding siblings ...)
2024-10-15 13:40 ` patchwork-bot+netdevbpf
@ 2024-10-15 18:00 ` patchwork-bot+netdevbpf
2024-11-17 11:56 ` (subset) " Michael Ellerman
18 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-15 18:00 UTC (permalink / raw)
To: Julia Lawall
Cc: linux-nfs, kernel-janitors, vbabka, paulmck, tom, Dai.Ngo,
okorniev, neilb, linux-can, bridge, b.a.t.m.a.n, linux-kernel,
wireguard, netdev, ecryptfs, linux-block, npiggin,
christophe.leroy, naveen, maddy, linuxppc-dev, kvm,
netfilter-devel, coreteam
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 13 Oct 2024 22:16:47 +0200 you wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were done using the following Coccinelle semantic patch.
> This semantic patch is designed to ignore cases where the callback
> function is used in another way.
>
> [...]
Here is the summary with links:
- [01/17] wireguard: allowedips: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [02/17] ipv4: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/netdev/net-next/c/497e17d80759
- [03/17] inetpeer: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/netdev/net-next/c/bb5810d4236b
- [04/17] ipv6: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/netdev/net-next/c/85e48bcf294c
- [05/17] xfrm6_tunnel: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [06/17] batman-adv: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [08/17] net: bridge: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/netdev/net-next/c/4ac64e570c33
- [10/17] can: gw: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [14/17] kcm: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/netdev/net-next/c/7bb3ecbc2b6b
- [15/17] netfilter: nf_conncount: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [16/17] netfilter: expect: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
- [17/17] netfilter: xt_hashlimit: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 01/17] wireguard: allowedips: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 01/17] wireguard: allowedips: " Julia Lawall
@ 2024-10-16 11:04 ` Uladzislau Rezki
0 siblings, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 11:04 UTC (permalink / raw)
Cc: Jason A. Donenfeld, kernel-janitors, vbabka, paulmck,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
wireguard, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:16:48PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> drivers/net/wireguard/allowedips.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c
> index 4b8528206cc8..175b1ca4f66f 100644
> --- a/drivers/net/wireguard/allowedips.c
> +++ b/drivers/net/wireguard/allowedips.c
> @@ -48,11 +48,6 @@ static void push_rcu(struct allowedips_node **stack,
> }
> }
>
> -static void node_free_rcu(struct rcu_head *rcu)
> -{
> - kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu));
> -}
> -
> static void root_free_rcu(struct rcu_head *rcu)
> {
> struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_DEPTH] = {
> @@ -330,13 +325,13 @@ void wg_allowedips_remove_by_peer(struct allowedips *table,
> child = rcu_dereference_protected(
> parent->bit[!(node->parent_bit_packed & 1)],
> lockdep_is_held(lock));
> - call_rcu(&node->rcu, node_free_rcu);
> + kfree_rcu(node, rcu);
> if (!free_parent)
> continue;
> if (child)
> child->parent_bit_packed = parent->parent_bit_packed;
> *(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) = child;
> - call_rcu(&parent->rcu, node_free_rcu);
> + kfree_rcu(parent, rcu);
> }
> }
>
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 05/17] xfrm6_tunnel: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 05/17] xfrm6_tunnel: " Julia Lawall
@ 2024-10-16 11:05 ` Uladzislau Rezki
0 siblings, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 11:05 UTC (permalink / raw)
To: Julia Lawall, Steffen Klassert
Cc: Steffen Klassert, kernel-janitors, vbabka, paulmck, Herbert Xu,
David S. Miller, David Ahern, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:16:52PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/ipv6/xfrm6_tunnel.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
> index bf140ef781c1..c3c893ddb6ee 100644
> --- a/net/ipv6/xfrm6_tunnel.c
> +++ b/net/ipv6/xfrm6_tunnel.c
> @@ -178,12 +178,6 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
> }
> EXPORT_SYMBOL(xfrm6_tunnel_alloc_spi);
>
> -static void x6spi_destroy_rcu(struct rcu_head *head)
> -{
> - kmem_cache_free(xfrm6_tunnel_spi_kmem,
> - container_of(head, struct xfrm6_tunnel_spi, rcu_head));
> -}
> -
> static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr)
> {
> struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
> @@ -200,7 +194,7 @@ static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr)
> if (refcount_dec_and_test(&x6spi->refcnt)) {
> hlist_del_rcu(&x6spi->list_byaddr);
> hlist_del_rcu(&x6spi->list_byspi);
> - call_rcu(&x6spi->rcu_head, x6spi_destroy_rcu);
> + kfree_rcu(x6spi, rcu_head);
> break;
> }
> }
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 08/17] net: bridge: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 ` [PATCH 08/17] net: bridge: " Julia Lawall
2024-10-14 7:04 ` Nikolay Aleksandrov
@ 2024-10-16 11:07 ` Uladzislau Rezki
1 sibling, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 11:07 UTC (permalink / raw)
To: Julia Lawall, Roopa Prabhu
Cc: Roopa Prabhu, kernel-janitors, vbabka, paulmck,
Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, bridge, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:16:55PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/bridge/br_fdb.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 642b8ccaae8e..1cd7bade9b3b 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -73,13 +73,6 @@ static inline int has_expired(const struct net_bridge *br,
> time_before_eq(fdb->updated + hold_time(br), jiffies);
> }
>
> -static void fdb_rcu_free(struct rcu_head *head)
> -{
> - struct net_bridge_fdb_entry *ent
> - = container_of(head, struct net_bridge_fdb_entry, rcu);
> - kmem_cache_free(br_fdb_cache, ent);
> -}
> -
> static int fdb_to_nud(const struct net_bridge *br,
> const struct net_bridge_fdb_entry *fdb)
> {
> @@ -329,7 +322,7 @@ static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f,
> if (test_and_clear_bit(BR_FDB_DYNAMIC_LEARNED, &f->flags))
> atomic_dec(&br->fdb_n_learned);
> fdb_notify(br, f, RTM_DELNEIGH, swdev_notify);
> - call_rcu(&f->rcu, fdb_rcu_free);
> + kfree_rcu(f, rcu);
> }
>
> /* Delete a local entry if no other port had the same address.
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 14/17] kcm: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:17 ` [PATCH 14/17] kcm: " Julia Lawall
@ 2024-10-16 12:16 ` Uladzislau Rezki
0 siblings, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 12:16 UTC (permalink / raw)
To: Julia Lawall, David S. Miller
Cc: David S. Miller, kernel-janitors, vbabka, paulmck, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:17:01PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/kcm/kcmsock.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
> index d4118c796290..24aec295a51c 100644
> --- a/net/kcm/kcmsock.c
> +++ b/net/kcm/kcmsock.c
> @@ -1584,14 +1584,6 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
> return err;
> }
>
> -static void free_mux(struct rcu_head *rcu)
> -{
> - struct kcm_mux *mux = container_of(rcu,
> - struct kcm_mux, rcu);
> -
> - kmem_cache_free(kcm_muxp, mux);
> -}
> -
> static void release_mux(struct kcm_mux *mux)
> {
> struct kcm_net *knet = mux->knet;
> @@ -1619,7 +1611,7 @@ static void release_mux(struct kcm_mux *mux)
> knet->count--;
> mutex_unlock(&knet->mutex);
>
> - call_rcu(&mux->rcu, free_mux);
> + kfree_rcu(mux, rcu);
> }
>
> static void kcm_done(struct kcm_sock *kcm)
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 16/17] netfilter: expect: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:17 ` [PATCH 16/17] netfilter: expect: " Julia Lawall
@ 2024-10-16 12:18 ` Uladzislau Rezki
0 siblings, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 12:18 UTC (permalink / raw)
To: Julia Lawall, Pablo Neira Ayuso
Cc: Pablo Neira Ayuso, kernel-janitors, vbabka, paulmck,
Jozsef Kadlecsik, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netfilter-devel, coreteam, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:17:03PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/netfilter/nf_conntrack_expect.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
> index 21fa550966f0..9dcaef6f3663 100644
> --- a/net/netfilter/nf_conntrack_expect.c
> +++ b/net/netfilter/nf_conntrack_expect.c
> @@ -367,18 +367,10 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,
> }
> EXPORT_SYMBOL_GPL(nf_ct_expect_init);
>
> -static void nf_ct_expect_free_rcu(struct rcu_head *head)
> -{
> - struct nf_conntrack_expect *exp;
> -
> - exp = container_of(head, struct nf_conntrack_expect, rcu);
> - kmem_cache_free(nf_ct_expect_cachep, exp);
> -}
> -
> void nf_ct_expect_put(struct nf_conntrack_expect *exp)
> {
> if (refcount_dec_and_test(&exp->use))
> - call_rcu(&exp->rcu, nf_ct_expect_free_rcu);
> + kfree_rcu(exp, rcu);
> }
> EXPORT_SYMBOL_GPL(nf_ct_expect_put);
>
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 15/17] netfilter: nf_conncount: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:17 ` [PATCH 15/17] netfilter: nf_conncount: " Julia Lawall
@ 2024-10-16 12:18 ` Uladzislau Rezki
0 siblings, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 12:18 UTC (permalink / raw)
To: Julia Lawall, Pablo Neira Ayuso
Cc: Pablo Neira Ayuso, kernel-janitors, vbabka, paulmck,
Jozsef Kadlecsik, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netfilter-devel, coreteam, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:17:02PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/netfilter/nf_conncount.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
> index 4890af4dc263..6a7a6c2d6ebc 100644
> --- a/net/netfilter/nf_conncount.c
> +++ b/net/netfilter/nf_conncount.c
> @@ -275,14 +275,6 @@ bool nf_conncount_gc_list(struct net *net,
> }
> EXPORT_SYMBOL_GPL(nf_conncount_gc_list);
>
> -static void __tree_nodes_free(struct rcu_head *h)
> -{
> - struct nf_conncount_rb *rbconn;
> -
> - rbconn = container_of(h, struct nf_conncount_rb, rcu_head);
> - kmem_cache_free(conncount_rb_cachep, rbconn);
> -}
> -
> /* caller must hold tree nf_conncount_locks[] lock */
> static void tree_nodes_free(struct rb_root *root,
> struct nf_conncount_rb *gc_nodes[],
> @@ -295,7 +287,7 @@ static void tree_nodes_free(struct rb_root *root,
> spin_lock(&rbconn->list.list_lock);
> if (!rbconn->list.count) {
> rb_erase(&rbconn->node, root);
> - call_rcu(&rbconn->rcu_head, __tree_nodes_free);
> + kfree_rcu(rbconn, rcu_head);
> }
> spin_unlock(&rbconn->list.list_lock);
> }
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 17/17] netfilter: xt_hashlimit: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:17 ` [PATCH 17/17] netfilter: xt_hashlimit: " Julia Lawall
@ 2024-10-16 12:19 ` Uladzislau Rezki
0 siblings, 0 replies; 36+ messages in thread
From: Uladzislau Rezki @ 2024-10-16 12:19 UTC (permalink / raw)
To: Julia Lawall, Pablo Neira Ayuso
Cc: Pablo Neira Ayuso, kernel-janitors, vbabka, paulmck,
Jozsef Kadlecsik, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netfilter-devel, coreteam, netdev, linux-kernel
On Sun, Oct 13, 2024 at 10:17:04PM +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were made using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> net/netfilter/xt_hashlimit.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
> index 0859b8f76764..c2b9b954eb53 100644
> --- a/net/netfilter/xt_hashlimit.c
> +++ b/net/netfilter/xt_hashlimit.c
> @@ -256,18 +256,11 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
> return ent;
> }
>
> -static void dsthash_free_rcu(struct rcu_head *head)
> -{
> - struct dsthash_ent *ent = container_of(head, struct dsthash_ent, rcu);
> -
> - kmem_cache_free(hashlimit_cachep, ent);
> -}
> -
> static inline void
> dsthash_free(struct xt_hashlimit_htable *ht, struct dsthash_ent *ent)
> {
> hlist_del_rcu(&ent->node);
> - call_rcu(&ent->rcu, dsthash_free_rcu);
> + kfree_rcu(ent, rcu);
> ht->count--;
> }
> static void htable_gc(struct work_struct *work);
>
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: (subset) [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
` (17 preceding siblings ...)
2024-10-15 18:00 ` patchwork-bot+netdevbpf
@ 2024-11-17 11:56 ` Michael Ellerman
18 siblings, 0 replies; 36+ messages in thread
From: Michael Ellerman @ 2024-11-17 11:56 UTC (permalink / raw)
To: linux-nfs, Julia Lawall
Cc: kernel-janitors, vbabka, paulmck, Tom Talpey, Dai Ngo,
Olga Kornievskaia, Neil Brown, linux-can, bridge, b.a.t.m.a.n,
linux-kernel, wireguard, netdev, ecryptfs, linux-block,
Nicholas Piggin, Christophe Leroy, Naveen N Rao,
Madhavan Srinivasan, linuxppc-dev, kvm, netfilter-devel, coreteam
On Sun, 13 Oct 2024 22:16:47 +0200, Julia Lawall wrote:
> Since SLOB was removed and since
> commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> it is not necessary to use call_rcu when the callback only performs
> kmem_cache_free. Use kfree_rcu() directly.
>
> The changes were done using the following Coccinelle semantic patch.
> This semantic patch is designed to ignore cases where the callback
> function is used in another way.
>
> [...]
Applied to powerpc/topic/ppc-kvm.
[13/17] KVM: PPC: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
https://git.kernel.org/powerpc/c/1db6a4e8a3fc8ccaa4690272935e02831dc6d40d
cheers
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2024-11-17 12:04 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13 20:16 [PATCH 00/17] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Julia Lawall
2024-10-13 20:16 ` [PATCH 01/17] wireguard: allowedips: " Julia Lawall
2024-10-16 11:04 ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 02/17] ipv4: " Julia Lawall
2024-10-14 7:41 ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 03/17] inetpeer: " Julia Lawall
2024-10-14 7:42 ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 04/17] ipv6: " Julia Lawall
2024-10-14 7:43 ` Eric Dumazet
2024-10-13 20:16 ` [PATCH 05/17] xfrm6_tunnel: " Julia Lawall
2024-10-16 11:05 ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 06/17] batman-adv: " Julia Lawall
2024-10-14 7:03 ` Sven Eckelmann
2024-10-14 7:08 ` Julia Lawall
2024-10-14 7:19 ` Vlastimil Babka
2024-10-14 8:03 ` Sven Eckelmann
2024-10-13 20:16 ` [PATCH 08/17] net: bridge: " Julia Lawall
2024-10-14 7:04 ` Nikolay Aleksandrov
2024-10-16 11:07 ` Uladzislau Rezki
2024-10-13 20:16 ` [PATCH 10/17] can: gw: " Julia Lawall
2024-10-14 3:03 ` Vincent MAILHOL
2024-10-13 20:17 ` [PATCH 14/17] kcm: " Julia Lawall
2024-10-16 12:16 ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 15/17] netfilter: nf_conncount: " Julia Lawall
2024-10-16 12:18 ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 16/17] netfilter: expect: " Julia Lawall
2024-10-16 12:18 ` Uladzislau Rezki
2024-10-13 20:17 ` [PATCH 17/17] netfilter: xt_hashlimit: " Julia Lawall
2024-10-16 12:19 ` Uladzislau Rezki
2024-10-13 20:53 ` (subset) [PATCH 00/17] " Jens Axboe
2024-10-14 0:31 ` Paul E. McKenney
2024-10-14 7:23 ` Vlastimil Babka
2024-10-14 11:26 ` Pablo Neira Ayuso
2024-10-15 13:40 ` patchwork-bot+netdevbpf
2024-10-15 18:00 ` patchwork-bot+netdevbpf
2024-11-17 11:56 ` (subset) " Michael Ellerman
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).