[ovs-dev,v2,06/11] datapath: Using kfree_rcu() to simplify the code

Message ID 1518018601-31980-7-git-send-email-gvrose8192@gmail.com
State Accepted
Headers show
Series
  • Add upstream Linux 4.14 kernel support
Related show

Commit Message

Gregory Rose Feb. 7, 2018, 3:49 p.m.
From: Wei Yongjun <weiyongjun1@huawei.com>

Upstream commit:
    commit 6dc14dc40a1d1dafd8491c349b5f3e15aabc4edb
    Author: Wei Yongjun <weiyongjun1@huawei.com>
    Date:   Tue Nov 14 06:27:12 2017 +0000

    openvswitch: Using kfree_rcu() to simplify the code

    The callback function of call_rcu() just calls a kfree(), so we
    can use kfree_rcu() instead of call_rcu() + callback function.

    Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
    Acked-by: Pravin B Shelar <pshelar@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/meter.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Patch

diff --git a/datapath/meter.c b/datapath/meter.c
index bc940ae..7b9391d 100644
--- a/datapath/meter.c
+++ b/datapath/meter.c
@@ -42,19 +42,12 @@  static const struct nla_policy band_policy[OVS_BAND_ATTR_MAX + 1] = {
 	[OVS_BAND_ATTR_STATS] = { .len = sizeof(struct ovs_flow_stats) },
 };
 
-static void rcu_free_ovs_meter_callback(struct rcu_head *rcu)
-{
-	struct dp_meter *meter = container_of(rcu, struct dp_meter, rcu);
-
-	kfree(meter);
-}
-
 static void ovs_meter_free(struct dp_meter *meter)
 {
 	if (!meter)
 		return;
 
-	call_rcu(&meter->rcu, rcu_free_ovs_meter_callback);
+	kfree_rcu(meter, rcu);
 }
 
 static struct hlist_head *meter_hash_bucket(const struct datapath *dp,