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.