mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Chuck Ebbert <cebbert@redhat.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Anders Bostr?m <anders@bostrom.dyndns.org>,
	linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: high load average when idle
Date: Wed, 3 Oct 2007 11:02:06 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.999.0710031058320.3579@woody.linux-foundation.org> (raw)
In-Reply-To: <4703D212.6040304@redhat.com>



On Wed, 3 Oct 2007, Chuck Ebbert wrote:
> 
> But we reduce the number of samples because some ticks just never
> happen when the timers get rounded:
> 
> No rounding:
> 
>       tick ............... tick
>      1 running            1 running
> 
> Rounded:
> 
>       tick
>      2 running
> 
> In the first case the average is 1, but it's 2 in the second.

In fact, I think this is it!

The load average is not calculated every tick, because that's not just 
expensive, but we also want to have some time-based decay. So it's 
calculated every LOAD_FREQ ticks.

And guess what: LOAD_FREQ is defined to be exactly five seconds.

So imagine if the timer gets to be in sync with another event that happens 
every five seconds - let's pick at random a 5-second JBD transaction 
thing?

Anders - does this idiotic patch make a difference for you?

Without this, I can easily imagine that the rounding code tends to try to 
round to an even second, and the load-average code generally also runs at 
even seconds!

		Linus

---
 include/linux/sched.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index a01ac6d..643de0f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -113,7 +113,7 @@ extern unsigned long avenrun[];		/* Load averages */
 
 #define FSHIFT		11		/* nr of bits of precision */
 #define FIXED_1		(1<<FSHIFT)	/* 1.0 as fixed-point */
-#define LOAD_FREQ	(5*HZ)		/* 5 sec intervals */
+#define LOAD_FREQ	(5*HZ+1)	/* ~5 sec intervals */
 #define EXP_1		1884		/* 1/exp(5sec/1min) as fixed-point */
 #define EXP_5		2014		/* 1/exp(5sec/5min) */
 #define EXP_15		2037		/* 1/exp(5sec/15min) */

  reply	other threads:[~2007-10-03 18:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-02 21:37 Anders Boström
2007-10-02 22:07 ` Andrew Morton
2007-10-02 22:32   ` Linus Torvalds
2007-10-02 22:39     ` Arjan van de Ven
2007-10-02 22:46     ` Mark Lord
2007-10-02 23:22       ` Arjan van de Ven
2007-10-02 23:40         ` Mark Lord
2007-10-02 23:19     ` Arjan van de Ven
2007-10-02 22:33   ` Chuck Ebbert
2007-10-02 23:26     ` Arjan van de Ven
2007-10-03 17:32       ` Chuck Ebbert
2007-10-03 18:02         ` Linus Torvalds [this message]
2007-10-03 18:20           ` Arjan van de Ven
2007-10-03 18:28             ` Linus Torvalds
2007-10-03 18:29               ` Arjan van de Ven
2007-10-03 20:15           ` Anders Boström
2007-10-03 18:34   ` Anders Boström
2007-10-02 23:13 ` Arjan van de Ven
2007-10-03  7:04   ` Anders Boström
2007-10-03  9:40 ` Thorsten Kranzkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.0.999.0710031058320.3579@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=anders@bostrom.dyndns.org \
    --cc=arjan@linux.intel.com \
    --cc=cebbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®