Skip to content

Commit

Permalink
net: sched: 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 <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Feb 19, 2019
1 parent 780feae commit 6e07902
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions net/sched/sch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,19 +526,14 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt,
return stab;
}

static void stab_kfree_rcu(struct rcu_head *head)
{
kfree(container_of(head, struct qdisc_size_table, rcu));
}

void qdisc_put_stab(struct qdisc_size_table *tab)
{
if (!tab)
return;

if (--tab->refcnt == 0) {
list_del(&tab->list);
call_rcu(&tab->rcu, stab_kfree_rcu);
kfree_rcu(tab, rcu);
}
}
EXPORT_SYMBOL(qdisc_put_stab);
Expand Down

0 comments on commit 6e07902

Please sign in to comment.