kernel - Rewrite do_vmtotal and change the way VM statistics are collected
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 7 Oct 2013 01:50:36 +0000 (18:50 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 7 Oct 2013 01:50:36 +0000 (18:50 -0700)
commit6d538b476425b98b7d28d50562ab45c9a9949911
treeb555008105e752c18b216a2f436aba637b943f63
parent140fa02824c5d858f0e4017f65a030fb63c2ed1f
kernel - Rewrite do_vmtotal and change the way VM statistics are collected

* The vmtotal sysctl was iterating through all VM objects.  This is a
  problem on machines with huge amounts of memory which might have millions
  of VM objects.

* Collect running VM statistics in the swap pager and vm_page modules,
  on a per-cpu basis.  Add a struct vmtotal structure to globaldata.

  Active real memory use is how many VM pages are mapped to processes.

  Total real memory use is how many VM pages are allocated whether they
  are mapped to processes or not.

  Shared real memory use represents VM pages mapped to more than one process.

  Total virtual memory use uses total real memory plus allocated swap space.

  Remaining fields are left 0 and not currently supported.

* Represents a more realistic view of memmory and VM.  In particular,
  totalling up the file sizes for all mmap()'d files is no longer a
  collected statistic because the system really has no way of knowing
  how little or how much of the file is 'active', or even ever accessed.

* The vmtotal sysctl (e.g. used by systat -vm 1) now just iterates
  cpus to aggregate gd_vmtotal for VM statistics.  This is basically
  O(1) for VM statistics.  It still iterates processes (which we will
  want to fix too, eventually), but the main scaling issue was with VM
  objects and that has been fixed.
sys/platform/pc64/include/pmap.h
sys/platform/pc64/x86_64/pmap.c
sys/sys/globaldata.h
sys/sys/vmmeter.h
sys/vm/swap_pager.c
sys/vm/vm_meter.c
sys/vm/vm_page.c