vmstat(8) swap unit

2020/01/26

When you run vmstat, you get a bunch of numbers without units:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 ...
 1  2 889856 150008  44788 406152   47 5145  3693  5173 2696 4030 42  3 22 33  0

You can look up the units in the man page. The si and so columns under swap are described as:

Swap
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).

Additional information of what per second for most fields is above:

-S, –unit character
Switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. Note this does not change the swap (si/so) or block (bi/bo) fields.

Thus, it ultimately goes unspecified what the “amount” per second of swap activity is measured in.

But after this version of the man page was published, about a year and a half ago, it was discovered that this description was wrong. The -S option does change the si/so fields, and the amount is measured in that unit (with the default being K, or 1024 bytes).

A corrected version reads:

Swap
These are affected by the –unit option.
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).

and

-S, –unit character
Switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. Note this does not change the block (bi/bo) fields, which are always measured in blocks.

Here’s a listing of where the fixed version is distributed:

Source Status
Debian unstable Not updated
linux.die.net (different procps provider)
man7.org Updated
manpages.debian.org (Debian buster) Not updated
manpages.debian.org (Debian unstable) Not updated
manpages.ubuntu.com (Ubuntu 18.04) Not updated
manpages.ubuntu.com (Ubuntu 19.10) Not updated
jlk.fjfi.cvut.cz (Arch) Not updated
manned.org Not updated
skrenta.com (different procps provider)
linux.org Not updated
man.he.net Not updated
man.cx Not updated

My last post was about either The opposite of nonpareils or Brands in the bathroom. Find out which.