summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2019-02-16 09:19:55 +0100
committerDavid S. Miller <davem@davemloft.net>2019-02-19 01:34:51 +0100
commit6e07902f56fae81036ebc5a0b61d5ffdd739e4bc (patch)
treeca6e180f89295fcf044b6050435dcb023ff25ec8
parentmdio_bus: Fix PTR_ERR() usage after initialization to constant (diff)
downloadlinux-6e07902f56fae81036ebc5a0b61d5ffdd739e4bc.tar.xz
linux-6e07902f56fae81036ebc5a0b61d5ffdd739e4bc.zip
net: sched: using kfree_rcu() to simplify the code
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>
-rw-r--r--net/sched/sch_api.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index b8a388e4bcc4..352b46f98440 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -526,11 +526,6 @@ 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)
@@ -538,7 +533,7 @@ void qdisc_put_stab(struct qdisc_size_table *tab)
if (--tab->refcnt == 0) {
list_del(&tab->list);
- call_rcu(&tab->rcu, stab_kfree_rcu);
+ kfree_rcu(tab, rcu);
}
}
EXPORT_SYMBOL(qdisc_put_stab);