netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] pkt_sched: sch_drr: Fix drr_dequeue() loop
Date: Mon, 24 Nov 2008 13:15:07 +0100	[thread overview]
Message-ID: <492A9ACB.4050504@trash.net> (raw)
In-Reply-To: <20081124105345.GB13957@ff.dom.local>

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Jarek Poplawski wrote:
> (Changelog fixed only)
> 
> pkt_sched: sch_drr: Fix drr_dequeue() loop
> 
> If all child qdiscs of sch_drr are non-work-conserving (e.g. sch_tbf)
> drr_dequeue() will busy-loop waiting for skbs instead of leaving the
> job for a watchdog. Checking for list_empty() in each loop isn't
> necessary either, because this can never be true except the first time.

Thanks for the report. I don't like to overcomplicate treatment
of this broken configuration though, so this patch simply returns
NULL when the inner qdiscs is non-work-conserving.




[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 1491 bytes --]

commit f995e708c778d5c3201d769ffae636f6941654ed
Author: Patrick McHardy <kaber@trash.net>
Date:   Mon Nov 24 13:13:16 2008 +0100

    pkt_sched: sch_drr: fix drr_dequeue loop()
    
    Jarek Poplawski points out:
    
    If all child qdiscs of sch_drr are non-work-conserving (e.g. sch_tbf)
    drr_dequeue() will busy-loop waiting for skbs instead of leaving the
    job for a watchdog. Checking for list_empty() in each loop isn't
    necessary either, because this can never be true except the first time.
    
    Using non-work-conserving qdiscs as children of DRR makes no sense,
    simply bail out in that case.
    
    Reported-by: Jarek Poplawski <jarkao2@gmail.com>
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index 37e6ab9..e7a7e87 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -373,11 +373,13 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
 	struct sk_buff *skb;
 	unsigned int len;
 
-	while (!list_empty(&q->active)) {
+	if (list_empty(&q->active))
+		goto out;
+	while (1) {
 		cl = list_first_entry(&q->active, struct drr_class, alist);
 		skb = cl->qdisc->ops->peek(cl->qdisc);
 		if (skb == NULL)
-			goto skip;
+			goto out;
 
 		len = qdisc_pkt_len(skb);
 		if (len <= cl->deficit) {
@@ -390,9 +392,9 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
 		}
 
 		cl->deficit += cl->quantum;
-skip:
 		list_move_tail(&cl->alist, &q->active);
 	}
+out:
 	return NULL;
 }
 

  reply	other threads:[~2008-11-24 12:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19 14:26 pkt_sched: add DRR scheduler Patrick McHardy
2008-11-20 11:35 ` Jarek Poplawski
2008-11-20 11:42   ` Patrick McHardy
2008-11-20 11:51     ` Jarek Poplawski
2008-11-20 11:58       ` Patrick McHardy
2008-11-20 12:06         ` Jarek Poplawski
2008-11-20 12:10     ` David Miller
2008-11-21 12:19     ` [PATCH] " Jarek Poplawski
2008-11-21 12:36       ` Patrick McHardy
2008-11-21 12:37         ` David Miller
2008-11-24 10:50     ` [PATCH] pkt_sched: sch_drr: Fix drr_dequeue() loop Jarek Poplawski
2008-11-24 10:53     ` [PATCH v2] " Jarek Poplawski
2008-11-24 12:15       ` Patrick McHardy [this message]
2008-11-24 12:33         ` Jarek Poplawski
2008-11-24 12:38           ` Patrick McHardy
2008-11-24 12:51             ` Jarek Poplawski
2008-11-24 13:17               ` Patrick McHardy
2008-11-24 13:45                 ` Jarek Poplawski
2008-11-24 23:47                   ` David Miller
2008-11-25 11:42                     ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=492A9ACB.4050504@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=jarkao2@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).