From: Mark Lord <lkml@rtr.ca>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Anders Bostr?m <anders@bostrom.dyndns.org>,
linux-kernel@vger.kernel.org, arjan@linux.intel.com
Subject: Re: PROBLEM: high load average when idle
Date: Tue, 02 Oct 2007 18:46:18 -0400 [thread overview]
Message-ID: <4702CA3A.50600@rtr.ca> (raw)
In-Reply-To: <alpine.LFD.0.999.0710021514040.3579@woody.linux-foundation.org>
Linus Torvalds wrote:
>
> On Tue, 2 Oct 2007, Andrew Morton wrote:
>> This is unexpected. High load average is due to either a task chewing a
>> lot of CPU time or a task stuck in uninterruptible sleep.
>
> Not necessarily.
>
> We saw high loadaverages with the timer bogosity with "gettimeofday()" and
> "select()" not agreeing, so they would do things like
>
> date = time(..)
> select(.. , timeout = <time + 1> )
>
> and when "date" wasn't taking the jiffies offset into account, and thus
> mixing these kinds of different time sources, the select ended up
> returning immediately because they effectively used different clocks, and
> suddenly we had some applications chewing up 30% CPU time, because they
> were in a loop that *tried* to sleep.
>
> And I wonder if the same kind thing is effectively happening here: the
> code is written so that it *tries* to sleep, but the rounding of the clock
> basically means that it's trying to sleep using a different clock than the
> one we're using to wake things up with, so some percentage of the time it
> doesn't sleep at all!
>
> I wonder if the whole "round_jiffies()" thing should be written so that it
> never rounds down, or at least never rounds down to before the current
> second!
...
On a related note, {set/get}itimer() currently are buggy (since 2.6.11 or so),
also due to this round_jiffies() thing I believe.
If one sets ITIMER_PROF to, say, 5.000000 seconds, and then reads it back
very shortly thereafter, it will give 5.200000 seconds as the value (HZ==1000).
AFAIK, this should *never* be possible --> any read of get_itimer should never
return a value higher than the starting value. This makes ITIMER_PROF not very
useful for measuring one's own CPU usage, for example.
Cheers
next prev parent reply other threads:[~2007-10-02 22:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-02 21:37 PROBLEM: high load average when idle 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 [this message]
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
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=4702CA3A.50600@rtr.ca \
--to=lkml@rtr.ca \
--cc=akpm@linux-foundation.org \
--cc=anders@bostrom.dyndns.org \
--cc=arjan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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