summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-10-04 01:31:39 +0000
committerpeter <peter@FreeBSD.org>2002-10-04 01:31:39 +0000
commit978d5305107a4518622e0018f5dfff4e0ac5ea85 (patch)
tree58029885f8d63a9fab08006bc07753c79446466c /sys/kern/kern_thread.c
parent5c8b1185c3fd5d2b7d80578c5f453be557fa6ac5 (diff)
downloadFreeBSD-src-978d5305107a4518622e0018f5dfff4e0ac5ea85.zip
FreeBSD-src-978d5305107a4518622e0018f5dfff4e0ac5ea85.tar.gz
Add some unspeakable hackery to the tree under #ifdef __ia64__ to work
around limitations in the ia64 kernel stack handling code. Basically preallocate a bunch of threads (and hence kstacks) while contigmalloc() still works, and never free them back to the general memory pool. After the system has been running for a while, contigmalloc() eventually fails at a critical momemt and panics the system.
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 7123616..1b133a1 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -216,9 +216,23 @@ void
threadinit(void)
{
+#ifndef __ia64__
thread_zone = uma_zcreate("THREAD", sizeof (struct thread),
thread_ctor, thread_dtor, thread_init, thread_fini,
UMA_ALIGN_CACHE, 0);
+#else
+ /*
+ * XXX the ia64 kstack allocator is really lame and is at the mercy
+ * of contigmallloc(). This hackery is to pre-construct a whole
+ * pile of thread structures with associated kernel stacks early
+ * in the system startup while contigmalloc() still works. Once we
+ * have them, keep them. Sigh.
+ */
+ thread_zone = uma_zcreate("THREAD", sizeof (struct thread),
+ thread_ctor, thread_dtor, thread_init, thread_fini,
+ UMA_ALIGN_CACHE, UMA_ZONE_NOFREE);
+ uma_prealloc(thread_zone, 512); /* XXX arbitary */
+#endif
ksegrp_zone = uma_zcreate("KSEGRP", sizeof (struct ksegrp),
NULL, NULL, NULL, NULL,
UMA_ALIGN_CACHE, 0);
OpenPOWER on IntegriCloud