netdev
[Top] [All Lists]

Re: [PATCH 2.6 3/5]: Use double-linked list for dev->qdisc_list

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: [PATCH 2.6 3/5]: Use double-linked list for dev->qdisc_list
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Wed, 04 Aug 2004 21:55:34 +0200
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20040804094308.606f79bd.davem@xxxxxxxxxx>
References: <410FAE42.2050909@xxxxxxxxx> <20040804094308.606f79bd.davem@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
David S. Miller wrote:

On Tue, 03 Aug 2004 17:24:50 +0200
Patrick McHardy <kaber@xxxxxxxxx> wrote:

This patch changes dev->qdisc_list to a double-linked list. This solves
the performance problems when destroying qdiscs with large number of inner
qdiscs.

I don't see how this bit is correct:
You're right. This patch on top fixes the problem.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/04 21:51:04+02:00 kaber@xxxxxxxxxxxx 
#   [PKT_SCHED]: Fix q_idx calculation in tc_dump_qdisc
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# net/sched/sch_api.c
#   2004/08/04 21:50:44+02:00 kaber@xxxxxxxxxxxx +5 -2
#   [PKT_SCHED]: Fix q_idx calculation in tc_dump_qdisc
# 
diff -Nru a/net/sched/sch_api.c b/net/sched/sch_api.c
--- a/net/sched/sch_api.c       2004-08-04 21:55:13 +02:00
+++ b/net/sched/sch_api.c       2004-08-04 21:55:13 +02:00
@@ -817,13 +817,16 @@
                read_lock_bh(&qdisc_tree_lock);
                q_idx = 0;
                list_for_each_entry(q, &dev->qdisc_list, list) {
-                       if (q_idx++ < s_q_idx)
+                       if (q_idx < s_q_idx) {
+                               q_idx++;
                                continue;
+                       }
                        if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid,
                                          cb->nlh->nlmsg_seq, NLM_F_MULTI, 
RTM_NEWQDISC) <= 0) {
                                read_unlock_bh(&qdisc_tree_lock);
                                goto done;
                        }
+                       q_idx++;
                }
                read_unlock_bh(&qdisc_tree_lock);
        }
@@ -832,7 +835,7 @@
        read_unlock(&dev_base_lock);
 
        cb->args[0] = idx;
-       cb->args[1] = q_idx - 1;
+       cb->args[1] = q_idx;
 
        return skb->len;
 }
<Prev in Thread] Current Thread [Next in Thread>