Cleanup and untangling of kernel VM initialization
andre at freebsd.org
Fri Feb 1 13:25:44 UTC 2013
As an outcome of the recent problems with auto-sizing and auto-tuning of
the various kernel subsystems and related memory structures I've taken a
closer look at the whole KVM inner working and initialization process.
I've found the VM and KVM initialization to be somewhat obscure and stuck
half-way between the old 4.4BSD way and our modern SYSINIT concept.
While trying to understand all the steps I started to move things around,
into their own units and converted them to use SYSINITs. The result is
a patch that cleans up the majority of initialization process, removes
bitrot and moves it into the modern world order:
The changes in particular are:
Move large parts of vm/vm_init.c to SYSINIT()s and de-magic old-style
kernel vm initialization.
Move vm_ksubmap_init(), bufinit() and vm_pager_bufferinit() from machdep.c
to SYSINIT's. It was duplicated among all architectures which means that
is wasn't architecture specific.
Centralize definition of virtual_avail and virtual_end from the architectures
pmap.h to vm_extern.h.
Move various initializations from kern/subr_param.c to where it is actually
used and SYSINIT() in particular vm_pager (pager_map / nswbuf), vm_kern
(kernel_map), swap_pager (maxswzone), sys_pipe (pipe_map / maxpipekva),
vfs_bio (buffer_map / nbuf), kern_exec (exec_map / exec_map_entries),
kern_malloc (kmem_map), kern_timeout (callwheel, ncallout).
Move subsystem initializations from init_main.c to SYSINIT()s.
Add sysctl's to give detailed information on all kernel vm_maps and sub maps
Remove unused struct kva_md_info.
Rebase auto-sizing of limits on the available KVM/kmem_map instead of physical
memory. Depending on the kernel and architecture configuration these two can
be very different.
Comments and reviews appreciated.
For committing it'll be broken into meaningful and functional pieces with an
appropriate commit message each.
I've tested on amd64. Feedback from other architectures welcome. Especially
for powerpc where I had to modify the minidump routine slighly to avoid dumping
of buffer_map memory.
More information about the freebsd-current