kernel - Add zero-on-instantiate objcache ctor * When creating kmalloc-backed pools, M_ZERO cannot be passed to objcache_get() because the underlying kmalloc only occurs when the objcache is not recycling a cached entry. * Add a feature to the objcache whereby the allocation from backing store is zero'd. The reuse case will not be zerod, so users of this type of objcache must properly reset/cleanup fields before disposing of the object. * Used by HAMMER2.
kernel - Add lwkt.cache_threads boot-time tunable * Add lwkt.cache_threads boot-time tunable. This has to be set in /boot/loader.conf and controls how large a thread+kstack cache the kernel should maintain. * Increase the default thread+kstack cache from 6 to 32 threads. * Change the objcache_create*() API a little. Instead of passing a mag_capacity field pass a nom_cache (nominal free objects to keep cached) field. * Change the mag_capacity calculation to take into account small caches (the exec args cache) and remove the too-small-for-ncpus warning. Related-to: IRC conversion thesjg & vsrinivas
Pass NULL to objcache_create() to indicate that null_ctor() and/or null_dtor() should be used. Make null_ctor() and null_dtor() private functions. Disallow M_ZERO entirely, it doesn't really fit the objcache model. With-input-from: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>, "Thomas E. Spanjaard" <tgen@netphreax.net>, Jeffrey Hsu <hsu@crater.dragonflybsd.org>
I'm growing tired of having to add #include lines for header files that the include file(s) I really want depend on. Go through nearly all major system include files and add appropriately #ifndef'd #include lines to include all dependant header files. Kernel source files now only need to #include the header files they directly depend on. So, for example, if I wanted to add a SYSCTL to a kernel source file, I would only have to #include <sys/sysctl.h> to bring in the support for it, rather then four or five header files in addition to <sys/sysctl.h>.
Rollup mbuf/objcache fixes. * Completely replace the blocking algorithm that is used to stall when the depot has insufficient resources. * Use __offsetof() to calculate variable length structural sizes. * #if 0 out balancing code for now. There isn't actually much of a need for it since each cpu can hold no more then two magazines anyway. The depot will have the rest. * Increase the magazine capacity from 5 to 256 elements to improve performance. * The mbufs were being returned to a different objcache then they had been allocated from, due to a dependance on M_PKTHDR and M_EXT. But these flags can change unexpectedly and this led to lockups in the objcache code and other issues. Also the share count on the cluster may mean that it is not possible to release an mbuf+cluster back to its original mbuf+cluster cache... it may have to be DTORed instead. * Change the way ref counts are handled in the mclmeta_cache. The cache returns and expects a ref count of 0 now, and the link code deals with bumping it.