public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru•mvista.com>
To: benh@kernel•crashing.org
Cc: Olof Johansson <olof@lixom•net>,
	linuxppc-dev@ozlabs•org, paulus@samba•org
Subject: Re: New time code miscalculates cpu usage
Date: Thu, 25 Oct 2007 16:46:25 +0400	[thread overview]
Message-ID: <47209021.4080501@ru.mvista.com> (raw)
In-Reply-To: <1193262969.6653.32.camel@pasglop>

Hello.

Benjamin Herrenschmidt wrote:

>>>Not sure when this started happening, but I wanted to report it. I'll
>>>start bisecting in a day or two if noone else has gotten around to
>>>looking at it:

>>>$ echo "int main(void) { while(1); }" > test.c ; gcc test.c
>>>$ time ./a.out & sleep 2 ; killall a.out
>>>real    0m2.008s
>>>user    0m4.014s
>>>sys     0m0.002s

>>>Seen on POWER5 and PA6T, haven't tried anything else yet.

>>    I'm not surprised -- the kernel accounts twice for each tick.

> Your input would be much more valuable if you actually pointed out where
> that happens and why since you seem to know it.

   I've already pointed out the reason, yet it won't hurt to repeat indeed.
timer_interrupt() calls both account_process_time() and the hrtimers event 
handler which leads to:

- if determenistic accounting is off, account_process_time() is the same as
   update_process_times() which gets also calleed by hrtimers via the event
   handler, so we get each tick accounted for twice;

- if determenistic accounting is on, then timer_interrupt() calls
   account_process_time() and update_process_times() is still called by
   hrtimers, so each tick's gets accounted for userspace twice...

> Ben.

WBR, Sergei

      parent reply	other threads:[~2007-10-25 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16 20:25 New time code miscalculates cpu usage Olof Johansson
2007-10-17  6:07 ` Tony Breeds
2007-10-24 20:19   ` Olof Johansson
2007-10-24 20:17 ` Sergei Shtylyov
2007-10-24 21:56   ` Benjamin Herrenschmidt
2007-10-25  0:19     ` Paul Mackerras
2007-10-25  0:53       ` Benjamin Herrenschmidt
2007-10-25 12:46     ` Sergei Shtylyov [this message]

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=47209021.4080501@ru.mvista.com \
    --to=sshtylyov@ru$(echo .)mvista.com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=olof@lixom$(echo .)net \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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