[PATCH 3/4] net: openvswitch: convert call_rcu(dp_meter_instance_free_rcu) to kvfree_rcu()

Ran Xiaokai posted 4 patches 2 weeks ago
[PATCH 3/4] net: openvswitch: convert call_rcu(dp_meter_instance_free_rcu) to kvfree_rcu()
Posted by Ran Xiaokai 2 weeks ago
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>

The rcu callback dp_meter_instance_free_rcu() simply calls kvfree().
It's better to directly call kvfree_rcu().

Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
 net/openvswitch/meter.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index cc08e0403909..d99efb9ce1a0 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -83,14 +83,6 @@ static void dp_meter_instance_free(struct dp_meter_instance *ti)
 	kvfree(ti);
 }
 
-static void dp_meter_instance_free_rcu(struct rcu_head *rcu)
-{
-	struct dp_meter_instance *ti;
-
-	ti = container_of(rcu, struct dp_meter_instance, rcu);
-	kvfree(ti);
-}
-
 static int
 dp_meter_instance_realloc(struct dp_meter_table *tbl, u32 size)
 {
@@ -108,7 +100,7 @@ dp_meter_instance_realloc(struct dp_meter_table *tbl, u32 size)
 			new_ti->dp_meters[i] = ti->dp_meters[i];
 
 	rcu_assign_pointer(tbl->ti, new_ti);
-	call_rcu(&ti->rcu, dp_meter_instance_free_rcu);
+	kvfree_rcu(ti, rcu);
 
 	return 0;
 }
-- 
2.17.1
Re: [PATCH 3/4] net: openvswitch: convert call_rcu(dp_meter_instance_free_rcu) to kvfree_rcu()
Posted by Paolo Abeni 1 week, 6 days ago
On 11/20/24 07:47, Ran Xiaokai wrote:
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
> 
> The rcu callback dp_meter_instance_free_rcu() simply calls kvfree().
> It's better to directly call kvfree_rcu().
> 
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>

Since the patches in this series are independent one from each other,
please break the series on a per subsystem basis. The patch 3 & 4 should
target the net-next tree. It will simplify maintainers life (and yours).

Also please note:

## Form letter - net-next-closed

The merge window for v6.13 has begun and net-next is closed for new
drivers, features, code refactoring and optimizations. We are currently
accepting bug fixes only.

Please repost when net-next reopens after Dec 2nd.

RFC patches sent for review only are welcome at any time.

See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle