Skip to contentSkip to conversation

: Kill qdisc rcu freeing...

PATCH In review David Miller 2 participants 3 messages Aug 18, 2008 – Aug 19, 2008

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 : Kill qdisc rcu freeing...

Ok, I flipped the switch. I've checked in the following to net-2.6 and it seems to pass a bunch of smoke tests I just did (flood pings while adding and deleting various qdisc setups, etc.)

Jarek, I think we can possibly now revert that locking change you had to make because destroy was outside of RTNL?

pkt_sched: No longer destroy qdiscs from RCU.

We can now kill them synchronously with all of the previous dev_deactivate() cures.

This makes netdev destruction and shutdown saner as the qdiscs hold references to the device.

---
 include/net/sch_generic.h |    1 -
 net/sched/sch_generic.c   |   27 +++++++++------------------
 2 files changed, 9 insertions(+), 19 deletions(-)
include/net/sch_generic.h +0 -1
index 757ab08..84d25f2 100644
@@ -61,7 +61,6 @@ struct Qdisc
 	struct gnet_stats_basic	bstats;
 	struct gnet_stats_queue	qstats;
 	struct gnet_stats_rate_est	rate_est;
-	struct rcu_head 	q_rcu;
 	int			(*reshape_fail)(struct sk_buff *skb,
 					struct Qdisc *q);
 
net/sched/sch_generic.c +9 -18
index 30b76ae..6f96b7b 100644
@@ -518,14 +518,19 @@ void qdisc_reset(struct Qdisc *qdisc)
 }
 EXPORT_SYMBOL(qdisc_reset);
 
-/* this is the rcu callback function to clean up a qdisc when there
- * are no further references to it */
+/* Under qdisc_lock(qdisc) and BH! */
 
-static void __qdisc_destroy(struct rcu_head *head)
+void qdisc_destroy(struct Qdisc *qdisc)
 {
-	struct Qdisc *qdisc = container_of(head, struct Qdisc, q_rcu);
 	const struct Qdisc_ops  *ops = qdisc->ops;
 
+	if (qdisc->flags & TCQ_F_BUILTIN ||
+	    !atomic_dec_and_test(&qdisc->refcnt))
+		return;
+
+	if (qdisc->parent)
+		list_del(&qdisc->list);
+
 #ifdef CONFIG_NET_SCHED
 	qdisc_put_stab(qdisc->stab);
 #endif
@@ -542,20 +547,6 @@ static void __qdisc_destroy(struct rcu_head *head)
 
 	kfree((char *) qdisc - qdisc->padded);
 }
-
-/* Under qdisc_lock(qdisc) and BH! */
-
-void qdisc_destroy(struct Qdisc *qdisc)
-{
-	if (qdisc->flags & TCQ_F_BUILTIN ||
-	    !atomic_dec_and_test(&qdisc->refcnt))
-		return;
-
-	if (qdisc->parent)
-		list_del(&qdisc->list);
-
-	call_rcu(&qdisc->q_rcu, __qdisc_destroy);
-}
 EXPORT_SYMBOL(qdisc_destroy);
 
 static bool dev_all_qdisc_sleeping_noop(struct net_device *dev)
Signature · 1 line
1.5.6.5.GIT
#1 lore raw
Quoted 8 lines · David Miller

Ok, I flipped the switch. I've checked in the following to net-2.6 and it seems to pass a bunch of smoke tests I just did (flood pings while adding and deleting various qdisc setups, etc.)

Jarek, I think we can possibly now revert that locking change you had to make because destroy was outside of RTNL?

Yes, I think there are these two patches only to revert:

----------
commit d4766692e72422f3b0f0e9ac6773d92baad07d51

Author: Jarek Poplawski <[email protected]>
Date:   Wed Aug 13 15:20:24 2008 -0700

pkt_sched: Protect gen estimators under est_lock.

----------

commit 1cfa26661a85549063e369e2b40275eeaa7b923c

Author: Jarek Poplawski <[email protected]>
Date:   Mon Aug 11 18:11:06 2008 -0700

pkt_sched: Add BH protection for qdisc_stab_lock.

----------

I guess, I don't need to send any patches, but let me know if I'm wrong.

Thanks,
Jarek P.

Quoted 11 lines

pkt_sched: No longer destroy qdiscs from RCU.

We can now kill them synchronously with all of the previous dev_deactivate() cures.

This makes netdev destruction and shutdown saner as the qdiscs hold references to the device.

---

...

author maintainer
#2 lore raw

From: Jarek Poplawski <[email protected]>
Date: Mon, 18 Aug 2008 12:07:25 +0000

Quoted 13 lines · David Miller
Quoted 8 lines

Ok, I flipped the switch. I've checked in the following to net-2.6 and it seems to pass a bunch of smoke tests I just did (flood pings while adding and deleting various qdisc setups, etc.)

Jarek, I think we can possibly now revert that locking change you had to make because destroy was outside of RTNL?

Yes, I think there are these two patches only to revert:

----------

...

Quoted 1 line

commit d4766692e72422f3b0f0e9ac6773d92baad07d51

...

Quoted 1 line

----------

...

Quoted 1 line

commit 1cfa26661a85549063e369e2b40275eeaa7b923c

...

Quoted 4 lines

----------

I guess, I don't need to send any patches, but let me know if I'm wrong.

Thanks, I've reverted both commits.