* [PATCH] openvswitch: using kfree_rcu() to simplify the code
@ 2012-08-27 4:20 Wei Yongjun
[not found] ` <CAPgLHd_71Qh90j9FCkT2cQ35wNMkZeLDwHT2QLP55_3gfzfjTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2012-08-27 4:20 UTC (permalink / raw)
To: jesse-l0M0P4e3n4LQT0dZR+AlfA, davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY
From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
The callback function of call_rcu() just calls a kfree(), so we
can use kfree_rcu() instead of call_rcu() + callback function.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
---
net/openvswitch/flow.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index b7f38b1..c7bf2f2 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -427,19 +427,11 @@ void ovs_flow_deferred_free(struct sw_flow *flow)
call_rcu(&flow->rcu, rcu_free_flow_callback);
}
-/* RCU callback used by ovs_flow_deferred_free_acts. */
-static void rcu_free_acts_callback(struct rcu_head *rcu)
-{
- struct sw_flow_actions *sf_acts = container_of(rcu,
- struct sw_flow_actions, rcu);
- kfree(sf_acts);
-}
-
/* Schedules 'sf_acts' to be freed after the next RCU grace period.
* The caller must hold rcu_read_lock for this to be sensible. */
void ovs_flow_deferred_free_acts(struct sw_flow_actions *sf_acts)
{
- call_rcu(&sf_acts->rcu, rcu_free_acts_callback);
+ kfree_rcu(sf_acts, rcu);
}
static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key)
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <CAPgLHd_71Qh90j9FCkT2cQ35wNMkZeLDwHT2QLP55_3gfzfjTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] openvswitch: using kfree_rcu() to simplify the code [not found] ` <CAPgLHd_71Qh90j9FCkT2cQ35wNMkZeLDwHT2QLP55_3gfzfjTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-08-28 23:00 ` Jesse Gross 2012-08-31 19:57 ` David Miller 2012-09-20 17:47 ` Paul E. McKenney 1 sibling, 1 reply; 4+ messages in thread From: Jesse Gross @ 2012-08-28 23:00 UTC (permalink / raw) To: Wei Yongjun Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA, yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY, davem-fT/PcQaiUtIeIZ0/mPfg9Q On Sun, Aug 26, 2012 at 9:20 PM, Wei Yongjun <weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org> > > The callback function of call_rcu() just calls a kfree(), so we > can use kfree_rcu() instead of call_rcu() + callback function. > > spatch with a semantic match is used to found this problem. > (http://coccinelle.lip6.fr/) > > Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org> Thanks Wei. Acked-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] openvswitch: using kfree_rcu() to simplify the code 2012-08-28 23:00 ` Jesse Gross @ 2012-08-31 19:57 ` David Miller 0 siblings, 0 replies; 4+ messages in thread From: David Miller @ 2012-08-31 19:57 UTC (permalink / raw) To: jesse; +Cc: weiyj.lk, yongjun_wei, dev, netdev From: Jesse Gross <jesse@nicira.com> Date: Tue, 28 Aug 2012 16:00:24 -0700 > On Sun, Aug 26, 2012 at 9:20 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote: >> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >> >> The callback function of call_rcu() just calls a kfree(), so we >> can use kfree_rcu() instead of call_rcu() + callback function. >> >> spatch with a semantic match is used to found this problem. >> (http://coccinelle.lip6.fr/) >> >> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > > Thanks Wei. > > Acked-by: Jesse Gross <jesse@nicira.com> Applied to net-next ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] openvswitch: using kfree_rcu() to simplify the code [not found] ` <CAPgLHd_71Qh90j9FCkT2cQ35wNMkZeLDwHT2QLP55_3gfzfjTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-08-28 23:00 ` Jesse Gross @ 2012-09-20 17:47 ` Paul E. McKenney 1 sibling, 0 replies; 4+ messages in thread From: Paul E. McKenney @ 2012-09-20 17:47 UTC (permalink / raw) To: Wei Yongjun Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA, yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY, davem-fT/PcQaiUtIeIZ0/mPfg9Q On Mon, Aug 27, 2012 at 12:20:45PM +0800, Wei Yongjun wrote: > From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org> > > The callback function of call_rcu() just calls a kfree(), so we > can use kfree_rcu() instead of call_rcu() + callback function. > > spatch with a semantic match is used to found this problem. > (http://coccinelle.lip6.fr/) > > Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org> Reviewed-by: Paul E. McKenney <paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> > --- > net/openvswitch/flow.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c > index b7f38b1..c7bf2f2 100644 > --- a/net/openvswitch/flow.c > +++ b/net/openvswitch/flow.c > @@ -427,19 +427,11 @@ void ovs_flow_deferred_free(struct sw_flow *flow) > call_rcu(&flow->rcu, rcu_free_flow_callback); > } > > -/* RCU callback used by ovs_flow_deferred_free_acts. */ > -static void rcu_free_acts_callback(struct rcu_head *rcu) > -{ > - struct sw_flow_actions *sf_acts = container_of(rcu, > - struct sw_flow_actions, rcu); > - kfree(sf_acts); > -} > - > /* Schedules 'sf_acts' to be freed after the next RCU grace period. > * The caller must hold rcu_read_lock for this to be sensible. */ > void ovs_flow_deferred_free_acts(struct sw_flow_actions *sf_acts) > { > - call_rcu(&sf_acts->rcu, rcu_free_acts_callback); > + kfree_rcu(sf_acts, rcu); > } > > static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key) > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-20 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27 4:20 [PATCH] openvswitch: using kfree_rcu() to simplify the code Wei Yongjun
[not found] ` <CAPgLHd_71Qh90j9FCkT2cQ35wNMkZeLDwHT2QLP55_3gfzfjTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-28 23:00 ` Jesse Gross
2012-08-31 19:57 ` David Miller
2012-09-20 17:47 ` Paul E. McKenney
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.