Red Hat Bugzilla – Bug 107339
top shows 0% CPU usage for niced processes
Last modified: 2007-11-30 17:06:58 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701
Description of problem:
"top" incorrectly shows 0% CPU usage for "nice"ed processes. vmstat shows
correct cpu usage, "top" "CPU states" display shows correct cpu usage.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. run "nice -10 ./eatcpu.exe" (see source code below)
2. run "top"
3. observe high cpu usage in the "cpu nice" state display
4. observe high load average
5. observe "eatcpu.exe" incorrectly showing 0% cpu usage in the per-process display
Source code for eatcpu.exe:
[olchansk@tw00 utils]$ cat ./eatcpu.c
/* eatcpu.c */
int main(int argc,char*argv)
/* do nothing */
/* NOT REACHED */
/* end file */
[olchansk@tw00 utils]$ g++ -o eatcpu.exe -g -O0 eatcpu.c
[olchansk@tw00 utils]$ nice -10 ./eatcpu.exe
Forgot to attach the incorrect "top" output while running "nice -10 ./eatcpu.exe":
19:40:24 up 8 days, 5:17, 4 users, load average: 1.04, 0.41, 0.25
75 processes: 73 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 0.0% 100.0% 0.0% 0.0% 0.0% 0.0% 100.0%
cpu00 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 100.0%
cpu01 0.0% 100.0% 0.0% 0.0% 0.0% 0.0% 0.0%
Mem: 2037152k av, 1632696k used, 404456k free, 0k shrd, 230768k buff
434500k actv, 65012k in_d, 35684k in_c
Swap: 4096564k av, 16k used, 4096548k free 664644k cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1466 olchansk 15 0 1336 1336 948 R 0.0 0.0 0:00 0 top
1495 olchansk 35 10 768 768 664 R N 0.0 0.0 0:00 1 eatcpu.exe
ugh. pretty bad.
Hmm, arjan claimed he has seen similar bugs that have been fixes in later kernel
versions. Might be fixed already.
Yeah. I don't get this with kernel 2.4.21-2.ELsmp and procps-2.0.13-9.2E.
What kernel are you using? Can you try a later one?
Too many different versions floating around.
I have kernel 2.4.21-1.1931.2.393.entsmp and procps-2.0.13-9E. Where do I get
the rpms you guys mention?
Amd64 Rawhide has procps-2.0.17-1. I installed it and it has the same problem.
Amd64 Rawhide has kernel-2.4.20-9.2, older than the one you mention
(2.4.21-2.ELsmp) and older than what I run (2.4.21-1.1931.2.393.entsmp). Should
I try it?
BTW, I am confused by the "taroon" versions. What came with the machine claims
to be "Red Hat Enterprise Linux release 2.9.5WS (Taroon)". Is this "beta",
"beta2" or what?
I'm really not sure about the kernel versions. I'm reassigning to kernel so
someone who knows about this can reply.
this was fixed in kernel, latest is in RHN
I confirm that the problem does not exist with kernel-smp-2.4.21-4.EL (from
RHEL3.0) and procps-2.0.17-1 (from Rawhide). K.O.