Skip to content

Commit 6e07902

Browse files
Wei Yongjundavem330
authored andcommitted
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>
1 parent 780feae commit 6e07902

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

net/sched/sch_api.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,19 +526,14 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt,
526526
return stab;
527527
}
528528

529-
static void stab_kfree_rcu(struct rcu_head *head)
530-
{
531-
kfree(container_of(head, struct qdisc_size_table, rcu));
532-
}
533-
534529
void qdisc_put_stab(struct qdisc_size_table *tab)
535530
{
536531
if (!tab)
537532
return;
538533

539534
if (--tab->refcnt == 0) {
540535
list_del(&tab->list);
541-
call_rcu(&tab->rcu, stab_kfree_rcu);
536+
kfree_rcu(tab, rcu);
542537
}
543538
}
544539
EXPORT_SYMBOL(qdisc_put_stab);

0 commit comments

Comments
 (0)