kern/140892: Incorrect cpu usage of per process under FreeBSD 8.0

wang jin wangjin at myhexin.com
Thu Nov 26 09:50:03 UTC 2009


>Number:         140892
>Category:       kern
>Synopsis:       Incorrect cpu usage of per process under FreeBSD 8.0
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 26 09:50:03 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     wang jin
>Release:        FreeBSD 8.0
>Organization:
hexin
>Environment:
FreeBSD cachehm1 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Thu Nov 26 00:14:56 CST 2009     root at cachehm1:/usr/src/sys/amd64/compile/GENERIC  amd64
>Description:
Squid is the main service of my box, and consumes most system resource.
I ran top command on my box,the output shows CPU1 has 8.6% user usage, but cpu usage of each process is 0.00%.
FreeBSD 7.2 has no such problem.

# top -CP
last pid: 68141;  load averages:  0.15,  0.14,  0.10                                                                                 up 0+17:04:07  17:21:00
45 processes:  1 running, 44 sleeping
CPU 0:  0.0% user,  0.0% nice,  3.0% system,  0.0% interrupt, 97.0% idle
CPU 1:  8.6% user,  0.0% nice,  1.1% system,  0.0% interrupt, 90.2% idle
Mem: 4293M Active, 2477M Inact, 791M Wired, 131M Cache, 827M Buf, 228M Free
Swap: 4096M Total, 4096M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME    CPU COMMAND
 4608 squid      17  44    0   783M   767M ucond   0 140:34  0.00% squid
 1140 root        1  76    0  7232K  1492K piperd  0   1:31  0.00% sh
 1139 root        1  44    0  8304K  2268K pause   1   0:05  0.00% top
 1709 root        1  44    0 36912K  3820K select  1   0:03  0.00% sshd
  953 bind        5  44    0 21356K 13656K kqread  0   0:02  0.00% named
 1079 root        1  44   r0  7012K  1056K nanslp  0   0:02  0.00% watchdogd
 1714 root        1  44    0  8252K  2456K pause   0   0:00  0.00% csh
 1324 root        1  44    0  7976K  1388K select  0   0:00  0.00% inetd
 1284 root        1  44    0  6920K  1340K nanslp  0   0:00  0.00% cron
  878 root        1  44    0  5864K  1272K select  0   0:00  0.00% syslogd
67786 root        1  44    0  8304K  1872K CPU1    0   0:00  0.00% top
  707 root        1  44    0  2180K   476K select  1   0:00  0.00% devd
 1275 root        1  44    0 24980K  3380K select  1   0:00  0.00% sshd
 1130 root        1  46    0  7232K  1420K wait    1   0:00  0.00% sh
 1131 root        1  76    0  7232K  1452K wait    1   0:00  0.00% sh
 1346 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1347 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1351 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1352 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1353 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1350 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1349 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 1348 root        1  76    0  5860K  1056K ttyin   0   0:00  0.00% getty
 4609 squid       1  46    0  2732K   688K piperd  1   0:00  0.00% unlinkd
  130 root        1  76    0  2736K   852K pause   1   0:00  0.00% adjkerntz

>How-To-Repeat:
run top command.

Note: 
The displayed CPU usage of some programs such as squid is too low, but this is not true for all types of programs.
I ran "sh test.sh", and the CPU usage of test.sh is nearly 100% which seems correct.
# cat test.sh
while true
do
done

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list