> Date: Fri, 16 Oct 2026 15:25:14 +0000
> From: Emmanuel Dreyfus <[email protected]>
> 
> Hello
> 
> systat(1) called with the vm argument shows some VM statistics, 
> including free memory. Here is the output:
> 
> Anon      2681436  33%   zero         
> Exec       202860   2%   wired   88688
> File      1402936  17%   inact  247712
> Meta       146893    %   bufs    13519
>  (kB)        real   swaponly      free
> Active    3950772              3071716 

Isn't this saying all the numbers (other than those marked with %) are
in kilobytes?

> The man page says:
>   Below this are statistics on memory utilization.  The first
>   row of the table reports memory usage only among active pro-
>   cesses, that is processes that have run in the previous
>   twenty seconds.  The second row reports on memory usage of
>   all processes.  The first column reports on the number of
>   physical pages claimed by processes.  The second column
>   reports the number of pages of memory and swap.  The third
>   column gives the number of pages of free memory and swap.
> 
> That does not fit the display very well, it seems systat was
> updated and the documentation was left behind. I assume 
> 3071716 is the unued memory, but it cannot be in pages:
> hw.physmem64 = 8503410688
> hw.pagesize = 4096
> 
> 3071716 pages of 4096 bytes would not fit in 8503410688 bytes.
> Most likely the numbers are in kB. 
> 
> Did I miss something or this man page needs an update?

The npage ma text and the current code came from a patch by Greg Woods
in 2007 (applied in 2018), submitted in PR bin/36542: better "systat
vm" output <https://gnats.NetBSD.org/36542>.

It looks to me like the man page should say `kilobytes', not
`pages'.  If I'm reading the right part of the code (after 30sec of
skimming), it appears to be converting internal numbers of pages to
display numbers of kilobytes:

https://nxr.NetBSD.org/xref/src/usr.bin/systat/vmstat.c?r=1.93#499

Reply via email to