* [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu()
@ 2025-10-05 13:39 Fushuai Wang
2025-10-07 12:55 ` Paolo Abeni
2026-01-12 3:10 ` Fushuai Wang
0 siblings, 2 replies; 4+ messages in thread
From: Fushuai Wang @ 2025-10-05 13:39 UTC (permalink / raw)
To: Jason, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: wireguard, netdev, linux-kernel, Fushuai Wang
Replace call_rcu() + kmem_cache_free() with kfree_rcu() to simplify
the code and reduce function size.
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
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 09f7fcd7da78..5ece9acad64d 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] = {
@@ -271,13 +266,13 @@ static void remove_node(struct allowedips_node *node, struct mutex *lock)
if (free_parent)
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)
return;
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);
}
static int remove(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
--
2.36.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu()
2025-10-05 13:39 [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu() Fushuai Wang
@ 2025-10-07 12:55 ` Paolo Abeni
2026-01-12 3:10 ` Fushuai Wang
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2025-10-07 12:55 UTC (permalink / raw)
To: Fushuai Wang, Jason, andrew+netdev, davem, edumazet, kuba
Cc: wireguard, netdev, linux-kernel
On 10/5/25 3:39 PM, Fushuai Wang wrote:
> Replace call_rcu() + kmem_cache_free() with kfree_rcu() to simplify
> the code and reduce function size.
>
> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
> ---
> 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 09f7fcd7da78..5ece9acad64d 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] = {
> @@ -271,13 +266,13 @@ static void remove_node(struct allowedips_node *node, struct mutex *lock)
> if (free_parent)
> 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)
> return;
> 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);
> }
>
> static int remove(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
This is net-next material, and net-next is currently closed for the
merge window, but I guess Jason will take this patch in his tree.
Cheers,
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu()
2025-10-05 13:39 [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu() Fushuai Wang
2025-10-07 12:55 ` Paolo Abeni
@ 2026-01-12 3:10 ` Fushuai Wang
2026-01-12 11:41 ` Vadim Fedorenko
1 sibling, 1 reply; 4+ messages in thread
From: Fushuai Wang @ 2026-01-12 3:10 UTC (permalink / raw)
To: wangfushuai
Cc: Jason, andrew+netdev, davem, edumazet, kuba, linux-kernel, netdev,
pabeni, wireguard
> Replace call_rcu() + kmem_cache_free() with kfree_rcu() to simplify
> the code and reduce function size.
Gentle ping.
---
Regards,
WANG
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu()
2026-01-12 3:10 ` Fushuai Wang
@ 2026-01-12 11:41 ` Vadim Fedorenko
0 siblings, 0 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2026-01-12 11:41 UTC (permalink / raw)
To: Fushuai Wang, wangfushuai
Cc: Jason, andrew+netdev, davem, edumazet, kuba, linux-kernel, netdev,
pabeni, wireguard
On 12/01/2026 03:10, Fushuai Wang wrote:
>> Replace call_rcu() + kmem_cache_free() with kfree_rcu() to simplify
>> the code and reduce function size.
>
> Gentle ping.
I believe you have to resend the patch as it's not going to be
automatically re-evaluated. And you have to rebase it on top of current
net-next. While preparing new patch, please add clear indentification of
the target tree, the subject should look like "[PATCH net-next v3] ..."
in your case.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-12 11:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-05 13:39 [PATCH v2] wireguard: allowedips: Use kfree_rcu() instead of call_rcu() Fushuai Wang
2025-10-07 12:55 ` Paolo Abeni
2026-01-12 3:10 ` Fushuai Wang
2026-01-12 11:41 ` Vadim Fedorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox