Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jun 2003 06:09:41 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Pete Fritchman <petef@absolutbsd.org>
Cc:        current@freebsd.org
Subject:   Re: vmstat -s broken
Message-ID:  <20030604054926.T20844@gamplex.bde.org>
In-Reply-To: <20030603190113.GA42673@absolutbsd.org>
References:  <000001c32a00$a3e227e0$4116f00a@corona> <20030603190113.GA42673@absolutbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 3 Jun 2003, Pete Fritchman wrote:

> ++ 03/06/03 20:47 +0200 - Pawel Worach:
> | I don't know for how long this has been broken but vmstat
> | always reports 0 (zero) for the number of system calls
> | executed which is virtually impossible.
> |
> | This is on a system built
> | FreeBSD darkstar 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Tue Jun  3 02:48:51
> | CEST 2003
> |
> | darkstar# vmstat -s | grep "system calls"
> |
> |         0 system calls
> | darkstar# uptime
>
> FWIW, I also see this behaviour on -current built Feb 13th:
>
> knap.sac(/home/sac1/petef) [258] > vmstat -s | grep system.calls
>         0 system calls
> knap.sac(/home/sac1/petef) [259] > uname -a
> FreeBSD knap.sac.fedex.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0:
> Thu Feb 13 16:26:14 CST 2003
> root@knap.sac.fedex.com:/usr/obj/usr/src/sys/SAC-DELL240-5  i386
> knap.sac(/home/sac1/petef) [260] >

Rev.1.67 of vm/vm_meter.c unbroke the sysctl that returns the number of
syscalls, but vmstat(1) accesses cnt.v_syscalls in kmem so it is still
broken.  systat(1) uses the sysctl so it was unbroken.  Using the sysctl
updates cnt.v_syscall, but programs that read it from kmem see a stale
value (the one made by the last call to the sysctl).

I use a different fix which restores the previous code for the SMP
case.  The SMP case remains broken: the count is stored in per-CPU
data (in all cases in -current but only in the SMP case in my version)
so that updating it doesn't require locking or expensive atomic
operations.  Thus there is never any up to date copy of the full count,
and programs that access it in kmem need to know how to assemble it.
None do.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030604054926.T20844>