Message ID | 1510640832-115455-1-git-send-email-weiyongjun1@huawei.com |
---|---|
State | Not Applicable |
Headers | show |
Series | [ovs-dev,net-next] openvswitch: Using kfree_rcu() to simplify the code | expand |
On Tue, Nov 14, 2017 at 11:57 AM, Wei Yongjun <weiyongjun1@huawei.com> wrote: > 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>
From: Wei Yongjun <weiyongjun1@huawei.com> Date: Tue, 14 Nov 2017 06:27:12 +0000 > 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> Applied.
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index 2a5ba35..f9e2b1f 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -42,19 +42,12 @@ [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,
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> --- net/openvswitch/meter.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)