public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: loadavg 0.00, 0.01, 0.05 on idle
@ 2016-01-21  9:23 Vik Heyndrickx
  2016-01-21 15:28 ` Peter Zijlstra
  2016-01-21 18:54 ` [tip:sched/urgent] sched: Fix non-zero idle loadavg tip-bot for Vik Heyndrickx
  0 siblings, 2 replies; 5+ messages in thread
From: Vik Heyndrickx @ 2016-01-21  9:23 UTC (permalink / raw)
  To: a.p.zijlstra; +Cc: linux-kernel

Systems show a minimal load average of 0.00, 0.01, 0.05 even when they 
have no load at all.

Uptime and /proc/loadavg on all systems with kernels released during the 
last five years up until kernel version 4.4, show a 5- and 15-minute 
minimum loadavg of 0.01 and 0.05 respectively. This should be 0.00 on 
idle systems, but the way the kernel calculates this value prevents it 
from getting lower than the mentioned values. Likewise but not as 
obviously noticeable, a fully loaded system with no processes waiting, 
shows a maximum 1/5/15 loadavg of 1.00, 0.99, 0.95 (multiplied by number 
of cores).
By removing the single code line that performed a rounding on the 
internally kept load value, effectively returning this function 
calc_load to its state it had before, the visualization problem is 
completely fixed.
The modified code was tested on nohz=off and nohz kernels. It was tested 
on vanilla kernel 4.4 and on centos 7.1 kernel 3.10.0-327. It was tested 
on single, dual, and octal cores system. It was tested on virtual hosts 
and bare hardware. No unwanted effects have been observed, and the 
problems that the patch intended to fix were indeed gone.

The following patch is for kernel version 4.x . In kernel 3.x, the 
affected code was in core.c instead of loadavg.c

Signed-off-by: Vik Heyndrickx <vik.heyndrickx@veribox.net>

--- linux-4.4-org/kernel/sched/loadavg.c 2016-01-21 09:11:15 +0100
+++ linux-4.4/kernel/sched/loadavg.c 2016-01-21 09:11:31 +0100
@@ -101,7 +101,6 @@ calc_load(unsigned long load, unsigned l
  {
         load *= exp;
         load += active * (FIXED_1 - exp);
-       load += 1UL << (FSHIFT - 1);
         return load >> FSHIFT;
  }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-22  0:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21  9:23 [PATCH] sched: loadavg 0.00, 0.01, 0.05 on idle Vik Heyndrickx
2016-01-21 15:28 ` Peter Zijlstra
2016-01-21 18:38   ` Doug Smythies
2016-01-22  0:43     ` Vik Heyndrickx
2016-01-21 18:54 ` [tip:sched/urgent] sched: Fix non-zero idle loadavg tip-bot for Vik Heyndrickx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox