Skip to contentSkip to conversation

net_sched: no need to free qdisc in RCU callback

PATCH Applied Cong Wang 3 participants 3 messages Sep 19, 2017

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 net_sched: no need to free qdisc in RCU callback

gen estimator has been rewritten in commit 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators"), the caller no longer needs to wait for a grace period. So this patch gets rid of it.

Cc Jamal Hadi Salim <[email protected]>
Cc Eric Dumazet <[email protected]>
---
 include/net/sch_generic.h |  1 -
 net/sched/sch_generic.c   | 10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)
include/net/sch_generic.h +0 -1
index 135f5a2dd931..684d8ed27eaa 100644
@@ -93,7 +93,6 @@ struct Qdisc {
 	unsigned long		state;
 	struct Qdisc            *next_sched;
 	struct sk_buff		*skb_bad_txq;
-	struct rcu_head		rcu_head;
 	int			padded;
 	refcount_t		refcnt;
 
net/sched/sch_generic.c +2 -8
index 92237e75dbbc..1fb0c754b7fd 100644
@@ -688,10 +688,8 @@ void qdisc_reset(struct Qdisc *qdisc)
 }
 EXPORT_SYMBOL(qdisc_reset);
 
-static void qdisc_rcu_free(struct rcu_head *head)
+static void qdisc_free(struct Qdisc *qdisc)
 {
-	struct Qdisc *qdisc = container_of(head, struct Qdisc, rcu_head);
-
 	if (qdisc_is_percpu_stats(qdisc)) {
 		free_percpu(qdisc->cpu_bstats);
 		free_percpu(qdisc->cpu_qstats);
@@ -724,11 +722,7 @@ void qdisc_destroy(struct Qdisc *qdisc)
 
 	kfree_skb_list(qdisc->gso_skb);
 	kfree_skb(qdisc->skb_bad_txq);
-	/*
-	 * gen_estimator est_timer() might access qdisc->q.lock,
-	 * wait a RCU grace period before freeing qdisc.
-	 */
-	call_rcu(&qdisc->rcu_head, qdisc_rcu_free);
+	qdisc_free(qdisc);
 }
 EXPORT_SYMBOL(qdisc_destroy);
 
Signature · 1 line
2.13.0
maintainer Applied
#2 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Tue, 19 Sep 2017 13:15:42 -0700

Quoted 8 lines

gen estimator has been rewritten in commit 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators"), the caller no longer needs to wait for a grace period. So this patch gets rid of it.

Cc Jamal Hadi Salim <[email protected]>
Cc Eric Dumazet <[email protected]>

Nice.

Applied, thanks.