* [PATCH net-next] net: ovs: use kfree_rcu instead of rcu_free_{sw_flow_mask_cb,acts_callback}
@ 2013-12-10 11:02 Daniel Borkmann
2013-12-10 21:18 ` Jesse Gross
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2013-12-10 11:02 UTC (permalink / raw)
To: jesse; +Cc: netdev
As we're only doing a kfree() anyway in the RCU callback, we can
simply use kfree_rcu, which does the same job, and remove the
function rcu_free_sw_flow_mask_cb() and rcu_free_acts_callback().
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
net/openvswitch/flow_netlink.c | 10 +---------
net/openvswitch/flow_table.c | 9 +--------
2 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 2bc1bc1..0f37d87 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -1128,19 +1128,11 @@ struct sw_flow_actions *ovs_nla_alloc_flow_actions(int size)
return sfa;
}
-/* RCU callback used by ovs_nla_free_flow_actions. */
-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_nla_free_flow_actions(struct sw_flow_actions *sf_acts)
{
- call_rcu(&sf_acts->rcu, rcu_free_acts_callback);
+ kfree_rcu(sf_acts, rcu);
}
static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa,
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index 262d7ca..edec2b0 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -131,13 +131,6 @@ static void rcu_free_flow_callback(struct rcu_head *rcu)
flow_free(flow);
}
-static void rcu_free_sw_flow_mask_cb(struct rcu_head *rcu)
-{
- struct sw_flow_mask *mask = container_of(rcu, struct sw_flow_mask, rcu);
-
- kfree(mask);
-}
-
static void flow_mask_del_ref(struct sw_flow_mask *mask, bool deferred)
{
if (!mask)
@@ -149,7 +142,7 @@ static void flow_mask_del_ref(struct sw_flow_mask *mask, bool deferred)
if (!mask->ref_count) {
list_del_rcu(&mask->list);
if (deferred)
- call_rcu(&mask->rcu, rcu_free_sw_flow_mask_cb);
+ kfree_rcu(mask, rcu);
else
kfree(mask);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: ovs: use kfree_rcu instead of rcu_free_{sw_flow_mask_cb,acts_callback}
2013-12-10 11:02 [PATCH net-next] net: ovs: use kfree_rcu instead of rcu_free_{sw_flow_mask_cb,acts_callback} Daniel Borkmann
@ 2013-12-10 21:18 ` Jesse Gross
0 siblings, 0 replies; 2+ messages in thread
From: Jesse Gross @ 2013-12-10 21:18 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: netdev, dev@openvswitch.org
On Tue, Dec 10, 2013 at 3:02 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
> As we're only doing a kfree() anyway in the RCU callback, we can
> simply use kfree_rcu, which does the same job, and remove the
> function rcu_free_sw_flow_mask_cb() and rcu_free_acts_callback().
>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-10 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 11:02 [PATCH net-next] net: ovs: use kfree_rcu instead of rcu_free_{sw_flow_mask_cb,acts_callback} Daniel Borkmann
2013-12-10 21:18 ` Jesse Gross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).