[procps] vmstat and pages paged in/out

  • From: Jan Rybar <jrybar@xxxxxxxxxx>
  • To: Procps-ng Mail list <procps@xxxxxxxxxxxxx>
  • Date: Mon, 23 Jan 2017 16:12:19 +0100

Hello everyone,

I would like to ask someone with extensive knowledge of /proc/vmstat file.
I got a bugreport that manpage of vmstat does not provide exact description of items printed by 'vmstat -s', since pages paged in/out and pages swapped in/out seem to cause ambiguities.

So far I was able to find out, that pages swapped are really pages moved from/to memory to/from disk device as we all would expect. Some sources claim these are pages when entire process is swapped.
Another thing is pages paged in/out, as these are pages loaded up to/removed from memory SINCE BOOT, either moved to/from swap area, or paged in when process is starting or process is ending.

First I need to confirm this is true. I was going through kernel spaghetti and traced writings to /proc/vmstat for a while to support these statements, however calculations of vmstat's info differ from top's statistics a bit.

Also I was able to find that proc/sysinfo.c (line 825-ish) talks about kB, not pages (4 kB on x86_64). Got lost during hunting the real numbers.

unsigned long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line)
unsigned long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line)

No documentation on kernel.org. The closest information source was
http://linuxinsight.com/proc_vmstat.html
http://www.linuxjournal.com/article/8178
https://www.quora.com/What-is-difference-between-paging-and-swapping
https://community.hpe.com/t5/System-Administration/What-is-the-difference-between-page-in-amp-page-out-and-swap-in/m-p/4644124#M41047

Once I get onto solid ground with this, I'll prepare patch to vmstat's manpage, but all the sources seem too diverging to me.
ANY HELP APPRECIATED.

Thanks for your time. Have fun.

Jan

Other related posts: