New time code miscalculates cpu usage
Hi,
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.002sSeen on POWER5 and PA6T, haven't tried anything else yet.
-Olof
Quoted 6 lines · Olof Johansson
Hi,
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:
Quoted 7 lines
$ 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.002sSeen on POWER5 and PA6T, haven't tried anything else yet.
For what it's worth, this is my bug. I suspected it, and git bisect confirmed it.I have an ugly work around now, but hope to have something better out tomorrow.
Thanks Olof.
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
Quoted 13 lines · Tony Breeds
Quoted 12 lines · Olof Johansson
Hi,
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
Quoted 5 lines
Quoted 1 line
Seen on POWER5 and PA6T, haven't tried anything else yet.
For what it's worth, this is my bug. I suspected it, and git bisect confirmed it.I have an ugly work around now, but hope to have something better out tomorrow.
Hi Tony,
Any news?
-Olof
Hello.
Quoted 11 lines · Olof Johansson
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.002sSeen on POWER5 and PA6T, haven't tried anything else yet.
I'm not surprised -- the kernel accounts twice for each tick.
WBR, Sergei
Quoted 14 lines · Sergei Shtylyov
Hello.
Quoted 10 lines · Olof Johansson
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
Quoted 3 lines
Quoted 1 line
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.
Ben.
Quoted 2 lines · Benjamin Herrenschmidt
Your input would be much more valuable if you actually pointed out where that happens and why since you seem to know it.
He did already, a couple of messages ago.
Paul.
Quoted 6 lines · Paul Mackerras
Quoted 2 lines · Benjamin Herrenschmidt
Your input would be much more valuable if you actually pointed out where that happens and why since you seem to know it.
He did already, a couple of messages ago.
Allright, I missed that.
Ben.
Hello.
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines
Quoted 9 lines
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
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
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...
Quoted 1 line
Ben.
WBR, Sergei