HardenedBSD/sys
Konstantin Belousov c3cf0b476f Remove the altkstacks, instead instantiate threads with kernel stack
allocated with the right size from the start. For the thread that has
kernel stack cached, verify that requested stack size is equial to the
actual, and reallocate the stack if sizes differ [1].

This fixes the bug introduced by r173361 that was committed several days
after r173004 and consisted of kthread_add(9) ignoring the non-default
kernel stack size.

Also, r173361 removed the caching of the kernel stacks for a non-first
thread in the process. Introduce separate kernel stack cache that keeps
some limited amount of preallocated kernel stacks to lower the latency
of thread allocation. Add vm_lowmem handler to prune the cache on
low memory condition. This way, system with reasonable amount of the
threads get lower latency of thread creation, while still not exhausting
significant portion of KVA for unused kstacks.

Submitted by:	peter [1]
Discussed with:	jhb, julian, peter
Reviewed by:	jhb
Tested by:	pho
MFC after:	1 week
2009-08-29 13:28:02 +00:00
..
amd64 Fix handling of .note.ABI-tag section for GNU systems [1]. 2009-08-24 16:19:47 +00:00
arm Remove the altkstacks, instead instantiate threads with kernel stack 2009-08-29 13:28:02 +00:00
boot
bsm
cam - Add quirk for Sony DSC digital cameras. This umass devices fail 2009-08-26 21:14:28 +00:00
cddl - Hide ZFS kernel threads under zfskern process. 2009-08-23 11:33:46 +00:00
compat Fix a few panics in linuxulator + VIMAGE due to curvnet not being set. 2009-08-28 22:51:07 +00:00
conf Connect bwi up to the build. While there are some problems with this 2009-08-29 01:34:42 +00:00
contrib Fix argument ordering to memcpy as well as the size of the copy in the 2009-08-25 19:30:32 +00:00
crypto
ddb
dev change default regdomain for thailand 2009-08-27 17:42:37 +00:00
fs Fix poll() on half-closed sockets, while retaining POLLHUP for fifos. 2009-08-25 21:44:14 +00:00
gdb
geom There's no need for checking result of M_WAITOK allocation. 2009-08-27 08:40:51 +00:00
gnu
i386 Fix build broken in r196524. 2009-08-25 14:08:33 +00:00
ia64
isa Tweak the way that the ACPI and ISA bus drivers match hint devices to 2009-08-24 21:51:46 +00:00
kern Remove the altkstacks, instead instantiate threads with kernel stack 2009-08-29 13:28:02 +00:00
kgssapi
libkern
mips
modules Connect bwi up to the build. While there are some problems with this 2009-08-29 01:34:42 +00:00
net Introduce a separate sx lock for protecting lists of vnet sysinit 2009-08-28 22:30:55 +00:00
net80211
netatalk
netgraph Rework global locks for interface list and index management, correcting 2009-08-23 20:40:19 +00:00
netinet Fix a bug where vlan interfaces are not supported by SCTP. 2009-08-28 08:41:59 +00:00
netinet6 When multiple interfaces exist in the system, with each interface having 2009-08-26 21:32:50 +00:00
netipsec Rework global locks for interface list and index management, correcting 2009-08-23 20:40:19 +00:00
netipx
netnatm
netncp
netsmb
nfs
nfsclient Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet 2009-08-24 10:09:30 +00:00
nfsserver
nlm
opencrypto
pc98
pci Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to 2009-08-24 18:58:13 +00:00
powerpc
rpc Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet 2009-08-24 10:09:30 +00:00
security
sparc64
sun4v
sys Remove the altkstacks, instead instantiate threads with kernel stack 2009-08-29 13:28:02 +00:00
tools
ufs
vm Remove the altkstacks, instead instantiate threads with kernel stack 2009-08-29 13:28:02 +00:00
xdr
xen
Makefile