[PATCH 4/4] net: sysfs: convert call_rcu() to kvfree_rcu()

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

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

Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
 net/core/net-sysfs.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 2d9afc6e2161..8ba2251af077 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -947,13 +947,6 @@ static ssize_t show_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
 	return sysfs_emit(buf, "%lu\n", val);
 }
 
-static void rps_dev_flow_table_release(struct rcu_head *rcu)
-{
-	struct rps_dev_flow_table *table = container_of(rcu,
-	    struct rps_dev_flow_table, rcu);
-	vfree(table);
-}
-
 static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
 					    const char *buf, size_t len)
 {
@@ -1008,7 +1001,7 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
 	spin_unlock(&rps_dev_flow_lock);
 
 	if (old_table)
-		call_rcu(&old_table->rcu, rps_dev_flow_table_release);
+		kvfree_rcu(old_table, rcu);
 
 	return len;
 }
@@ -1046,7 +1039,7 @@ static void rx_queue_release(struct kobject *kobj)
 	flow_table = rcu_dereference_protected(queue->rps_flow_table, 1);
 	if (flow_table) {
 		RCU_INIT_POINTER(queue->rps_flow_table, NULL);
-		call_rcu(&flow_table->rcu, rps_dev_flow_table_release);
+		kvfree_rcu(flow_table, rcu);
 	}
 #endif
 
-- 
2.17.1