PKT_SCHED: Make rate estimator work for all platforms
Subsystems (3)
PATCH 1/1 PKT_SCHED: Make rate estimator work for all platforms
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.
net/sched/estimator.c +3 -7
@@ -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 5struct 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); }
Looking good.
Dave, Please apply all the patches (earlier 3 + this one) that Thomas posted.
cheers,
jamal
Quoted 45 lines · Thomas Graf
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 <[email protected]>net/sched/estimator.c +3
-7@@ -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 5struct 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); }
David S. Miller
maintainerQuoted 2 lines · On 04 Oct 2004 19:47:34 -0400 jamal <[email protected]> wrote:
Dave, Please apply all the patches (earlier 3 + this one) that Thomas posted.
Will do after I review it a bit more.
Thanks.
David S. Miller
maintainerQuoted 4 lines · On 04 Oct 2004 19:47:34 -0400 jamal <[email protected]> wrote:
Looking good.
Dave, Please apply all the patches (earlier 3 + this one) that Thomas posted.
All applied, thanks guys.