kernel - Adjust KVA use on i386 and x86_64
The i386 changes recover another ~60MB of KVM for kernel use. This is an
attempt to further reduce KVM use based on bug reports from people running
production systems.
The x86_64 changes recognize the now much-larger KVM space (128G+) and
remove some i386-era limitations.
* i386 - Reduce the nominal maximum swbufs on i386 from 256 to 128,
saving 16MB of KVM (and also 16MB of real memory).
Now that we have swbufs both with and without kva we don't really
need so many with kva.
* i386 - Reduce pv_entry reservation on machines with maximal memory
configurations from 2.5-3M entries down to 1.4M entries.
In addition to fixing a bug which counted vm_page_array_size twice
(which is also fixed on x86_64 in this commit), also put a soft cap
of 1.4M pv entries. Most production machines never even get close
to the old cap and this saves us at least 45MB of KVM on machines
with 3G+ of ram.
The cap can be raised with a kenv boot variable (vm.pmap.pv_entries).
* x86_64 - Increase the maximum buffer cache size from 400MB to 1GB.
This will effect machines with >4G of ram. A machine with 8G of
ram will wind up with ~800MB worth of buffer cache.
In particular this should improve HAMMER's cache performance since
the presence of a cache bp is needed to circumvent the per-mount
lock. This may also improve flushes but it is hard to say.
Reported-by: Peter Avalos <peter@theshell.com>