All of lore.kernel.org
 help / color / mirror / Atom feed
* iproute2 / htb / question
@ 2009-01-21 14:33 Denys Fedoryschenko
  2009-01-22  7:25 ` Jarek Poplawski
  0 siblings, 1 reply; 3+ messages in thread
From: Denys Fedoryschenko @ 2009-01-21 14:33 UTC (permalink / raw)
  To: netdev

I need to ask few questions, thats maybe better to ask somewhere like IRC. But 
mail is ok, if i can get answers...

Because i am not understanding well, how HTB works.
For example iproute2 over netlink sending various parameters. For me 
interesting now burst/cburst since they are seems incorrect.

It is some "tokens" that used to refill bucket each piece of time (related 
with get_hz and rate?) 
Is there any place i can read about this?

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

* Re: iproute2 / htb / question
  2009-01-21 14:33 iproute2 / htb / question Denys Fedoryschenko
@ 2009-01-22  7:25 ` Jarek Poplawski
  2009-01-22  9:45   ` [PATCH] iproute2 : invalid burst/cburst calculation with hrtimers Denys Fedoryschenko
  0 siblings, 1 reply; 3+ messages in thread
From: Jarek Poplawski @ 2009-01-22  7:25 UTC (permalink / raw)
  To: Denys Fedoryschenko; +Cc: netdev

On 21-01-2009 15:33, Denys Fedoryschenko wrote:
...
> It is some "tokens" that used to refill bucket each piece of time (related 
> with get_hz and rate?) 
> Is there any place i can read about this?

http://en.wikipedia.org/wiki/Token_bucket

Jarek P.

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

* [PATCH] iproute2 : invalid burst/cburst calculation with hrtimers
  2009-01-22  7:25 ` Jarek Poplawski
@ 2009-01-22  9:45   ` Denys Fedoryschenko
  0 siblings, 0 replies; 3+ messages in thread
From: Denys Fedoryschenko @ 2009-01-22  9:45 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

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

On Thursday 22 January 2009 09:25:41 Jarek Poplawski wrote:
> On 21-01-2009 15:33, Denys Fedoryschenko wrote:
> ...
>
> > It is some "tokens" that used to refill bucket each piece of time
> > (related with get_hz and rate?)
> > Is there any place i can read about this?
>
> http://en.wikipedia.org/wiki/Token_bucket
>
> Jarek P.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks a lot. Seems also Martin Devera pointed me, what can be issue.
HZ=1000000000 is way too high.
Real tests shows, that HZ=1000 more than enough with hrtimers on.

By the way possible it is triggered deadlock bug in htb, it is not a fix of this bug,
but a fix of very wrong behaviour, because of this bug 
HTB will use very extensively resources.

If it's required, i can give more detailed explanation

------------->
iproute2 : invalid burst/cburst calculation with hrtimers

If hrtimers on, /proc/net/psched shows 4th variable 
as 1000000000
Because burst calculated by division rate to this variable, 
it will be almost always zero. As result, we will get higher system 
load on low rates, and on high rates shaper will not able to process 
data. It is checked and proved. Core 2 Quad was not able to 
shape 200Mbps, and gave only 180-190. It is more safe to set it 
to 1000HZ. If user wants, he can set custom "env" HZ variable.

Signed-off-by: Denys Fedoryschenko <denys@visp.net.lb>
---

[-- Attachment #2: iproute2-htb-gethz-invalid.patch --]
[-- Type: text/x-diff, Size: 1261 bytes --]

diff -Naur iproute2/tc/q_htb.c iproute2-new/tc/q_htb.c
--- iproute2/tc/q_htb.c	2009-01-22 11:10:36.000000000 +0200
+++ iproute2-new/tc/q_htb.c	2009-01-22 11:31:40.000000000 +0200
@@ -110,6 +110,7 @@
 	unsigned mtu;
 	unsigned short mpu = 0;
 	unsigned short overhead = 0;
+	unsigned int bursthz;
 	unsigned int linklayer  = LINKLAYER_ETHERNET; /* Assume ethernet */
 	struct rtattr *tail;
 
@@ -209,9 +210,16 @@
 	if (!opt.ceil.rate) opt.ceil = opt.rate;
 
 	/* compute minimal allowed burst from rate; mtu is added here to make
-	   sute that buffer is larger than mtu and to have some safeguard space */
-	if (!buffer) buffer = opt.rate.rate / get_hz() + mtu;
-	if (!cbuffer) cbuffer = opt.ceil.rate / get_hz() + mtu;
+	   sure that buffer is larger than mtu and to have some safeguard space 
+	   With hrtimers enabled, hz variable gets too high resolution. If we
+	   use it for computing burst, burst will be too low. In worst case 
+	   we will not reach specified rate/ceil, in best - load will be too 
+	   high.
+	*/
+	bursthz = get_hz() == 1000000000 ? 1000 : get_hz();	
+
+	if (!buffer) buffer = opt.rate.rate / bursthz + mtu;
+	if (!cbuffer) cbuffer = opt.ceil.rate / bursthz + mtu;
 
 	opt.ceil.overhead = overhead;
 	opt.rate.overhead = overhead;

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

end of thread, other threads:[~2009-01-22  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-21 14:33 iproute2 / htb / question Denys Fedoryschenko
2009-01-22  7:25 ` Jarek Poplawski
2009-01-22  9:45   ` [PATCH] iproute2 : invalid burst/cburst calculation with hrtimers Denys Fedoryschenko

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.