Subject: bin/29981: vmstat(1) shows wrong system calls per interval
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Rui Paulo <rpaulo@netbsd-pt.org>
List: netbsd-bugs
Date: 04/15/2005 19:37:00
>Number:         29981
>Category:       bin
>Synopsis:       vmstat(1) shows wrong system calls per interval
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 15 19:37:00 +0000 2005
>Originator:     Rui Paulo <rpaulo@netbsd-pt.org>
>Release:        NetBSD 3.0_BETA
>Organization:
>Environment:
System: NetBSD proton.fnop.net 3.0_BETA NetBSD 3.0_BETA (PROTON) #1: Thu Mar 24 20:38:18 WET 2005 rpaulo@proton.fnop.net:/home/rpaulo/netbsd/obj/sys/arch/i386/compile/PROTON i386
Architecture: i386
Machine: i386
>Description:
vmstat(1) shows a wrong number of system calls per interval in the first
cycle:
$ vmstat -c 3 5 
 procs    memory      page                       disks      faults      cpu
 r b w    avm    fre  flt  re  pi   po   fr   sr f0 m0 w0   in   sy  cs us sy id
 0 0 0 227212  79428  383  23   0    0   17   39  0  0 11  236 4294964578 664 28  8 64
 1 0 0 227728  78912   15   0   0    0    0    0  0  0  2  334 4666 1174 10  4 86
 1 0 0 227920  78720   39   0   0    0    0    0  0  0  1  209 3215 871  9  3 89

As you can see, the first value of system calls per interval is wrong. I suspect
this is due to the lack of proper initialisation of the variable in question
(maybe an int overflow?), though I haven't looked at the code, yet.

This is a desktop system up for 5 days ATM, and since I never saw this problem I'm
not going to reboot it right now so I can diagnose it further (I suspect that with
a reboot the problem goes away, so the category of this PR may be wrong - kern instead
of bin).

>How-To-Repeat:
run vmstat
>Fix: