Skip to content

Commit

Permalink
openvswitch: Using kfree_rcu() to simplify the code
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Wei Yongjun authored and davem330 committed Nov 14, 2017
1 parent 06c2351 commit 6dc14dc
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions net/openvswitch/meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6dc14dc

Please sign in to comment.