[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120920174736.GJ2449@linux.vnet.ibm.com>
Date: Thu, 20 Sep 2012 10:47:36 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Wei Yongjun <weiyj.lk@...il.com>
Cc: jesse@...ira.com, davem@...emloft.net,
yongjun_wei@...ndmicro.com.cn, dev@...nvswitch.org,
netdev@...r.kernel.org
Subject: Re: [PATCH] openvswitch: using kfree_rcu() to simplify the code
On Mon, Aug 27, 2012 at 12:20:45PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@...ndmicro.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@...ndmicro.com.cn>
Reviewed-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> ---
> 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@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists