Messages in this thread | | | Date | Thu, 11 Jul 2002 08:27:13 +0200 (CEST) | From | Ingo Molnar <> | Subject | Re: O(1) batch scheduler |
| |
On Tue, 9 Jul 2002, Kevin O'Connor wrote:
> I looked through your sched-2.5.25-A5 patch, and I'm confused by the > idle_count array. It calculates the idle average of the last 9 seconds - > but why not just use a weighted average. A weighted average is going to > be very close to the true average, and where it differs the weighted > average should be preferable.
i agree, the hybrid weighted average you suggest is the right solution here, because the sampling in that case has a fixed frequency which is HZ-independent. I've applied your patch to my tree.
the problem with a pure weighted average (ie. no ->idle_count, just a weighted average calculated in the scheduler tick) is that with HZ=1000 and a 32-bit word length the sampling gets too inaccurate. For the average to be meaningful it needs to be at least 'a few seconds worth' - which is 'a few thousands of events' - the rounding errors are pretty severe in that case.
(a good example where a running average has fundamental accuracy problem is the ->sleep_avg sampling. The frequency of wakeups/sleep events can be almost arbitrarily high, destroying the accuracy of a weighted average.)
Ingo
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |