strange values in `systat -vm'

Mikhail Teterin mi+mx at aldan.algebra.com
Fri Sep 30 11:57:13 PDT 2005


On one of my computers the ``Dir-cache'' column of the systat's vm-display is 
always either empty or displays something like:

	Dir-cache
	hits    %
	   X  X00

When X happens to be too big, the X00 gets replaced by "****". Looking into 
the usr.bin/systat/vmstat.c, I find, that the numbers are coming from 
nchtotal.ncs_pass2, which is expected to be less than s.nchcount.

I put some debugging instrumentation around that code, and see that that 
second number (nchcount), however, is always zero and so nz() turns it into 
1, which leads to the multiplication by 100 I observe.

The nchcount is computed as:

	nchtotal.ncs_goodhits + nchtotal.ncs_badhits +
	   nchtotal.ncs_miss + nchtotal.ncs_long + nchtotal.ncs_neghits;

which does not, indeed, include the ncs_pass2. Should it? How does it work for 
others (including my other machines)?

The numbers are obtained via sysctl("vfs.cache.nchstats") and I don't know, 
what exactly they mean :-) A one-per-second call to sysctl from command line 
returns:

vfs.cache.nchstats: 2546 138 16 0 297 0 1753939 3111941
vfs.cache.nchstats: 2546 138 16 0 297 0 1753943 3111992
vfs.cache.nchstats: 2546 138 16 0 297 0 1753947 3112167
vfs.cache.nchstats: 2546 138 16 0 297 0 1753951 3112237
vfs.cache.nchstats: 2546 138 16 0 297 0 1753955 3112277
[...]

I saw this in 5.x and am still seeing it in 6.0B5.

	-mi


More information about the freebsd-current mailing list