Index: sys/kern/kern_synch.c =================================================================== --- sys/kern/kern_synch.c +++ sys/kern/kern_synch.c @@ -87,7 +87,7 @@ * Constants for averages over 1, 5, and 15 minutes * when sampling at 5 second intervals. */ -static fixpt_t cexp[3] = { +static uint64_t cexp[3] = { 0.9200444146293232 * FSCALE, /* exp(-1/12) */ 0.9834714538216174 * FSCALE, /* exp(-1/60) */ 0.9944598480048967 * FSCALE, /* exp(-1/180) */ @@ -611,14 +611,15 @@ static void loadav(void *arg) { - int i, nrun; + int i; + uint64_t nrun; struct loadavg *avg; - nrun = sched_load(); + nrun = (uint64_t)sched_load(); avg = &averunnable; for (i = 0; i < 3; i++) - avg->ldavg[i] = (cexp[i] * avg->ldavg[i] + + avg->ldavg[i] = (cexp[i] * (uint64_t)avg->ldavg[i] + nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT; /* Index: sys/sys/param.h =================================================================== --- sys/sys/param.h +++ sys/sys/param.h @@ -361,12 +361,10 @@ * Scale factor for scaled integers used to count %cpu time and load avgs. * * The number of CPU `tick's that map to a unique `%age' can be expressed - * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that - * can be calculated (assuming 32 bits) can be closely approximated using - * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). + * by the formula (1 / (2 ^ (FSHIFT - 11))). * * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', - * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. + * FSHIFT must be at least 11. */ #define FSHIFT 11 /* bits to right of fixed binary point */ #define FSCALE (1<