All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Tomasz Paszkowski <tomasz.paszkowski@e-wro.pl>
Cc: "David S. Miller" <davem@redhat.com>,
	hadi@cyberus.ca, devik@cdi.cz, netdev@oss.sgi.com
Subject: Re: Fw: hfsc and huge set of rules
Date: Sun, 01 Aug 2004 19:53:52 +0200	[thread overview]
Message-ID: <410D2E30.2050104@trash.net> (raw)
In-Reply-To: <20040730110815.GA7812@krezus.e-wro.net>

Tomasz Paszkowski wrote:

>On Fri, Jul 30, 2004 at 12:34:49PM +0200, Patrick McHardy wrote:
>  
>
>>hfsc_destroy_qdisc takes O(n) time wrt. the number of classes,
>>but 5-6 seconds is still long. If all these classes contain inner
>>qdiscs other than the default, I guess removing the classes from
>>dev->qdisc_list in qdisc_destroy takes up most of the time, with
>>n O(n) operations. The __qdisc_destroy rcu callback also calls
>>reset before destroy, I don't know any qdisc where this is really
>>neccessary. Without inner qdiscs, I need to see the script first to
>>judge what's going wrong. Tomasz ?
>>    
>>
>
>http://www.e-wro.pl/~acid/tc.batch.gz. In my opinion it's not the case
>of expensive algorithms, but the number of classes. With this rule set loaded
>(tc -b tc.batch) command:
>
>for i in 'e1.903 e0.930 e0.931 e0.932' ; do
>	tc qdisc del dev ${i} root
>done
>completly freezes machine for about 5-6 seconds.
>  
>
I've done some profiles with your script (on an old kernel without
the lockless loopback patch), qdisc_destroy takes up 89% of the time
when destroying the qdiscs.

These are the exact results:

- execute the script on unpatched kernel:

time:
real    2m28.822s
user    0m2.347s
sys     2m25.395s

top 5 in profile:
799773   65.4986  vmlinux                  vmlinux                  
qdisc_lookup
199964   16.3763  vmlinux                  vmlinux                  
qdisc_destroy
92504     7.5758  sch_hfsc.ko              sch_hfsc                 
hfsc_adjust_levels
36722     3.0074  sch_hfsc.ko              sch_hfsc                 
hfsc_get_class
12471     1.0213  vmlinux                  vmlinux                  
mark_offset_tsc


- execute the script on kernel using double-linked lists for 
dev->qdisc_list:

time:
real    0m51.804s
user    0m2.286s
sys     0m48.795s

top 5 in profile:
201152   49.6049  vmlinux                  vmlinux                  
qdisc_lookup
92706    22.8617  sch_hfsc.ko              sch_hfsc                 
hfsc_adjust_levels
37140     9.1589  sch_hfsc.ko              sch_hfsc                 
hfsc_get_class
12310     3.0357  sch_hfsc.ko              sch_hfsc                 
hfsc_bind_tcf
12190     3.0061  sch_hfsc.ko              sch_hfsc                 
hfsc_change_class

- destroy the qdiscs on unpatched kernel:

time:
real    0m13.258s
user    0m0.019s
sys     0m13.206s

top 5 in profile:
29839    89.5367  vmlinux                  vmlinux                  
qdisc_destroy
1229      3.6878  sch_hfsc.ko              sch_hfsc                 
hfsc_reset_class
338       1.0142  vmlinux                  vmlinux                  
mark_offset_tsc
289       0.8672  vmlinux                  vmlinux                  
qdisc_reset
287       0.8612  sch_hfsc.ko              sch_hfsc                 
rtsc_init

- destroy the qdiscs on kernel using double-linked lists for 
dev->qdisc_list:

time:
real    0m0.389s
user    0m0.019s
sys     0m0.363s

top 5 in profile:
1261     33.6896  sch_hfsc.ko              sch_hfsc                 
hfsc_reset_class
311       8.3088  sch_hfsc.ko              sch_hfsc                 
rtsc_init
277       7.4005  vmlinux                  vmlinux                  
qdisc_reset
187       4.9960  vmlinux                  vmlinux                  
free_block
181       4.8357  vmlinux                  vmlinux                  kfree

So double-linked lists clearly solve your problem. Using a hash would 
speed up
creating the qdiscs even more, but it wastes too much memory in my opinion.
I'm going to send a patch after I've fixed the other problems with 
qdisc_destroy.

>I was trying do modify the code od hfsc_qdisc_destroy scheduling another
>task using schedule_task (), but i don't have enough knowledge to do deal
>with proper locking of qdisc structures.
>  
>
That doesn't work, hfsc_qdisc_destroy is called under a lock.

Regards
Patrick

  parent reply	other threads:[~2004-08-01 17:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-30  4:18 Fw: hfsc and huge set of rules David S. Miller
2004-07-30 10:34 ` Patrick McHardy
2004-07-30 11:08   ` Tomasz Paszkowski
2004-07-30 20:38     ` jamal
2004-08-01 17:53     ` Patrick McHardy [this message]
2004-08-04  9:14       ` Tomasz Paszkowski
2004-07-30 15:54   ` devik
2004-08-01 17:56     ` 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=410D2E30.2050104@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.com \
    --cc=devik@cdi.cz \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    --cc=tomasz.paszkowski@e-wro.pl \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.