Skip to contentSkip to conversation

net: sched: using kfree_rcu() to simplify the code

PATCH Applied Wei Yongjun 2 participants 2 messages Feb 16, 2019 – Feb 19, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 net/sched/sch_api.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
net/sched/sch_api.c +1 -6
index 7e4d1cc..53b25b8 100644
@@ -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);