Re: [PATCH (update 3)] timer: Run calc_load halfway through each round_jiffies second

From: Eric Dumazet
Date: Fri Mar 02 2007 - 13:04:24 EST


On Friday 02 March 2007 18:32, Simon Arlott wrote:
> On 02/03/07 16:35, Eric Dumazet wrote:

> > You could just change LOAD_FREQ from (5*HZ) to (5*HZ+1)
> > You can see that 5.01 instead of 5.00 second gives the same EXP_xx
> > values.
> >
> > So (5*HZ + 1) is safe. (because HZ >= 100)
>
> On HZ=1000, this would cause the load average to be pushed towards +1.00
> for up to 2 minutes every ~83 minutes with no obvious cause. (If a task
> takes ~10-20ms to run, so 20 runs are needed at HZ=1000 before it passes
> it again).

Nope, you dont quite understand how load (avenrun[]) is computed.

Every 5 seconds, three values are adjusted, based on their previous value and
the actual value. Lets focus on the first value (mean load average on one
minute)

exp = 1.0 / exp(5.0/60.0);
avenrun[0] = (avenrun[0] * exp) + (active * (1.0 - exp));

If previous value is 0.0, and current active count 1, then next value for
avenrun[0] will be : 0.0799556

Not exactly 1.0 as you think !

Then in the next intervals (if active count is 0), it will decrease 'slowly' :
0.0735627
0.0676809
0.0622695
0.0572907

In average, your load factor close to reality.

Just try my suggestion, it should work. I even proved it in my previous
mail :)

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/