* [PATCH] PKT_SCHED: Make rate estimator work for all platforms
@ 2004-10-04 21:11 Thomas Graf
2004-10-04 23:47 ` jamal
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Graf @ 2004-10-04 21:11 UTC (permalink / raw)
To: David S. Miller; +Cc: Jamal Hadi Salim, netdev
Fixes the existing rate estimator to compile cleanly on all platforms
and avoids carrying on the variance on platforms with HZ%4 != 0.
Patch also applies to 2.4 with some fuzz.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
--- linux-2.6.9-rc3-bk4.orig/net/sched/estimator.c 2004-10-04 22:41:26.000000000 +0200
+++ linux-2.6.9-rc3-bk4/net/sched/estimator.c 2004-10-04 22:53:54.000000000 +0200
@@ -66,15 +66,11 @@
* Minimal interval is HZ/4=250msec (it is the greatest common divisor
for HZ=100 and HZ=1024 8)), maximal interval
- is (HZ/4)*2^EST_MAX_INTERVAL = 8sec. Shorter intervals
+ is (HZ*2^EST_MAX_INTERVAL)/4 = 8sec. Shorter intervals
are too expensive, longer ones can be implemented
at user level painlessly.
*/
-#if (HZ%4) != 0
-#error Bad HZ value.
-#endif
-
#define EST_MAX_INTERVAL 5
struct qdisc_estimator
@@ -128,7 +124,7 @@
spin_unlock(e->stats_lock);
}
- mod_timer(&elist[idx].timer, jiffies + ((HZ/4)<<idx));
+ mod_timer(&elist[idx].timer, jiffies + ((HZ<<idx)/4));
read_unlock(&est_lock);
}
@@ -161,7 +157,7 @@
if (est->next == NULL) {
init_timer(&elist[est->interval].timer);
elist[est->interval].timer.data = est->interval;
- elist[est->interval].timer.expires = jiffies + ((HZ/4)<<est->interval);
+ elist[est->interval].timer.expires = jiffies + ((HZ<<est->interval)/4);
elist[est->interval].timer.function = est_timer;
add_timer(&elist[est->interval].timer);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PKT_SCHED: Make rate estimator work for all platforms
2004-10-04 21:11 [PATCH] PKT_SCHED: Make rate estimator work for all platforms Thomas Graf
@ 2004-10-04 23:47 ` jamal
2004-10-05 0:38 ` David S. Miller
2004-10-05 21:05 ` David S. Miller
0 siblings, 2 replies; 4+ messages in thread
From: jamal @ 2004-10-04 23:47 UTC (permalink / raw)
To: Thomas Graf; +Cc: David S. Miller, netdev
Looking good.
Dave, Please apply all the patches (earlier 3 + this one) that Thomas
posted.
cheers,
jamal
On Mon, 2004-10-04 at 17:11, Thomas Graf wrote:
> Fixes the existing rate estimator to compile cleanly on all platforms
> and avoids carrying on the variance on platforms with HZ%4 != 0.
>
> Patch also applies to 2.4 with some fuzz.
>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>
>
> --- linux-2.6.9-rc3-bk4.orig/net/sched/estimator.c 2004-10-04 22:41:26.000000000 +0200
> +++ linux-2.6.9-rc3-bk4/net/sched/estimator.c 2004-10-04 22:53:54.000000000 +0200
> @@ -66,15 +66,11 @@
>
> * Minimal interval is HZ/4=250msec (it is the greatest common divisor
> for HZ=100 and HZ=1024 8)), maximal interval
> - is (HZ/4)*2^EST_MAX_INTERVAL = 8sec. Shorter intervals
> + is (HZ*2^EST_MAX_INTERVAL)/4 = 8sec. Shorter intervals
> are too expensive, longer ones can be implemented
> at user level painlessly.
> */
>
> -#if (HZ%4) != 0
> -#error Bad HZ value.
> -#endif
> -
> #define EST_MAX_INTERVAL 5
>
> struct qdisc_estimator
> @@ -128,7 +124,7 @@
> spin_unlock(e->stats_lock);
> }
>
> - mod_timer(&elist[idx].timer, jiffies + ((HZ/4)<<idx));
> + mod_timer(&elist[idx].timer, jiffies + ((HZ<<idx)/4));
> read_unlock(&est_lock);
> }
>
> @@ -161,7 +157,7 @@
> if (est->next == NULL) {
> init_timer(&elist[est->interval].timer);
> elist[est->interval].timer.data = est->interval;
> - elist[est->interval].timer.expires = jiffies + ((HZ/4)<<est->interval);
> + elist[est->interval].timer.expires = jiffies + ((HZ<<est->interval)/4);
> elist[est->interval].timer.function = est_timer;
> add_timer(&elist[est->interval].timer);
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PKT_SCHED: Make rate estimator work for all platforms
2004-10-04 23:47 ` jamal
@ 2004-10-05 0:38 ` David S. Miller
2004-10-05 21:05 ` David S. Miller
1 sibling, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-10-05 0:38 UTC (permalink / raw)
To: hadi; +Cc: tgraf, netdev
On 04 Oct 2004 19:47:34 -0400
jamal <hadi@cyberus.ca> wrote:
> Dave, Please apply all the patches (earlier 3 + this one) that Thomas
> posted.
Will do after I review it a bit more.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PKT_SCHED: Make rate estimator work for all platforms
2004-10-04 23:47 ` jamal
2004-10-05 0:38 ` David S. Miller
@ 2004-10-05 21:05 ` David S. Miller
1 sibling, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-10-05 21:05 UTC (permalink / raw)
To: hadi; +Cc: tgraf, netdev
On 04 Oct 2004 19:47:34 -0400
jamal <hadi@cyberus.ca> wrote:
>
> Looking good.
> Dave, Please apply all the patches (earlier 3 + this one) that Thomas
> posted.
All applied, thanks guys.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-10-05 21:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-04 21:11 [PATCH] PKT_SCHED: Make rate estimator work for all platforms Thomas Graf
2004-10-04 23:47 ` jamal
2004-10-05 0:38 ` David S. Miller
2004-10-05 21:05 ` David S. 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).