net: sched: using kfree_rcu() to simplify the code
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 16 Feb 2019 08:19:55 +0000 (08:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Feb 2019 00:34:51 +0000 (16:34 -0800)
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>
net/sched/sch_api.c

index b8a388e4bcc4e595a83dc5ba21d7fdef57d6e358..352b46f98440a06e184dbc409d6eb5a90e32226a 100644 (file)
@@ -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);