netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pkt_sched: sch_api: Remove qdisc_list_lock
@ 2008-11-25 11:29 Jarek Poplawski
  2008-11-25 11:44 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Jarek Poplawski @ 2008-11-25 11:29 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, netdev

After implementing qdisc->ops->peek() there is no more calling
qdisc_tree_decrease_qlen() without rtnl_lock(), so qdisc_list_lock
added by commit: f6e0b239a2657ea8cb67f0d83d0bfdbfd19a481b "pkt_sched:
Fix qdisc list locking" can be removed.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---

 net/sched/sch_api.c |   25 ++++---------------------
 1 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 1ef25e6..3fcfd4e 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -204,28 +204,16 @@ struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle)
 	return NULL;
 }
 
-/*
- * This lock is needed until some qdiscs stop calling qdisc_tree_decrease_qlen()
- * without rtnl_lock(); currently hfsc_dequeue(), netem_dequeue(), tbf_dequeue()
- */
-static DEFINE_SPINLOCK(qdisc_list_lock);
-
 static void qdisc_list_add(struct Qdisc *q)
 {
-	if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) {
-		spin_lock_bh(&qdisc_list_lock);
+	if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS))
 		list_add_tail(&q->list, &qdisc_root_sleeping(q)->list);
-		spin_unlock_bh(&qdisc_list_lock);
-	}
 }
 
 void qdisc_list_del(struct Qdisc *q)
 {
-	if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS)) {
-		spin_lock_bh(&qdisc_list_lock);
+	if ((q->parent != TC_H_ROOT) && !(q->flags & TCQ_F_INGRESS))
 		list_del(&q->list);
-		spin_unlock_bh(&qdisc_list_lock);
-	}
 }
 EXPORT_SYMBOL(qdisc_list_del);
 
@@ -234,22 +222,17 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
 	unsigned int i;
 	struct Qdisc *q;
 
-	spin_lock_bh(&qdisc_list_lock);
-
 	for (i = 0; i < dev->num_tx_queues; i++) {
 		struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
 		struct Qdisc *txq_root = txq->qdisc_sleeping;
 
 		q = qdisc_match_from_root(txq_root, handle);
 		if (q)
-			goto unlock;
+			goto out;
 	}
 
 	q = qdisc_match_from_root(dev->rx_queue.qdisc_sleeping, handle);
-
-unlock:
-	spin_unlock_bh(&qdisc_list_lock);
-
+out:
 	return q;
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pkt_sched: sch_api: Remove qdisc_list_lock
  2008-11-25 11:29 [PATCH] pkt_sched: sch_api: Remove qdisc_list_lock Jarek Poplawski
@ 2008-11-25 11:44 ` Patrick McHardy
  2008-11-25 11:46   ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2008-11-25 11:44 UTC (permalink / raw)
  To: Jarek Poplawski; +Cc: David Miller, Herbert Xu, netdev

Jarek Poplawski wrote:
> After implementing qdisc->ops->peek() there is no more calling
> qdisc_tree_decrease_qlen() without rtnl_lock(), so qdisc_list_lock
> added by commit: f6e0b239a2657ea8cb67f0d83d0bfdbfd19a481b "pkt_sched:
> Fix qdisc list locking" can be removed.

I might be misunderstanding something, but qdisc_tree_decrease_qlen()
doesn't need rtnl_lock() but the sch_tree_lock() since it changes
q.qlen.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pkt_sched: sch_api: Remove qdisc_list_lock
  2008-11-25 11:44 ` Patrick McHardy
@ 2008-11-25 11:46   ` Patrick McHardy
  2008-11-25 21:56     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2008-11-25 11:46 UTC (permalink / raw)
  To: Jarek Poplawski; +Cc: David Miller, Herbert Xu, netdev

Patrick McHardy wrote:
> Jarek Poplawski wrote:
>> After implementing qdisc->ops->peek() there is no more calling
>> qdisc_tree_decrease_qlen() without rtnl_lock(), so qdisc_list_lock
>> added by commit: f6e0b239a2657ea8cb67f0d83d0bfdbfd19a481b "pkt_sched:
>> Fix qdisc list locking" can be removed.
> 
> I might be misunderstanding something, but qdisc_tree_decrease_qlen()
> doesn't need rtnl_lock() but the sch_tree_lock() since it changes
> q.qlen.

OK I see now, rtnl_lock() was taken to protect the parent qdisc lookup.
In that case it seems fine, all callers are holding both sch_tree_lock()
and rtnl_lock().

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pkt_sched: sch_api: Remove qdisc_list_lock
  2008-11-25 11:46   ` Patrick McHardy
@ 2008-11-25 21:56     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-11-25 21:56 UTC (permalink / raw)
  To: kaber; +Cc: jarkao2, herbert, netdev

From: Patrick McHardy <kaber@trash.net>
Date: Tue, 25 Nov 2008 12:46:25 +0100

> Patrick McHardy wrote:
> > Jarek Poplawski wrote:
> >> After implementing qdisc->ops->peek() there is no more calling
> >> qdisc_tree_decrease_qlen() without rtnl_lock(), so qdisc_list_lock
> >> added by commit: f6e0b239a2657ea8cb67f0d83d0bfdbfd19a481b "pkt_sched:
> >> Fix qdisc list locking" can be removed.
> > I might be misunderstanding something, but qdisc_tree_decrease_qlen()
> > doesn't need rtnl_lock() but the sch_tree_lock() since it changes
> > q.qlen.
> 
> OK I see now, rtnl_lock() was taken to protect the parent qdisc lookup.
> In that case it seems fine, all callers are holding both sch_tree_lock()
> and rtnl_lock().

:-)

I've applied Jarek's patch.

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-25 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25 11:29 [PATCH] pkt_sched: sch_api: Remove qdisc_list_lock Jarek Poplawski
2008-11-25 11:44 ` Patrick McHardy
2008-11-25 11:46   ` Patrick McHardy
2008-11-25 21:56     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).