summaryrefslogtreecommitdiff
path: root/kern/thread.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-07-07 08:10:04 +0000
committerRichard Braun <rbraun@sceen.net>2012-07-07 08:10:04 +0000
commit43d2ad0d2043a278a2772519013f25a0bc4b067f (patch)
tree7f146c960d883c1355dacd41d5c330fb67644928 /kern/thread.c
parent2d2da4aad582bf1d63554cd9496285787db3e66e (diff)
Allocate kernel thread stacks out of kmem_map
The kernel submaps eat most of the available kernel space. Using the main kernel map for thread stacks sometimes lead to exhaustion when many threads are created. Use kmem_map instead to increase this limit. * kern/thread.c (stack_alloc): Use kmem_map instead of kernel_map for stack allocation. (stack_collect): Likewise for release.
Diffstat (limited to 'kern/thread.c')
-rw-r--r--kern/thread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kern/thread.c b/kern/thread.c
index 27faf43..d279bc8 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -208,7 +208,7 @@ void stack_alloc(
* addresses of a stack given an address in the middle.
*/
- if (kmem_alloc_aligned(kernel_map, &stack, KERNEL_STACK_SIZE)
+ if (kmem_alloc_aligned(kmem_map, &stack, KERNEL_STACK_SIZE)
!= KERN_SUCCESS)
panic("stack_alloc");
@@ -268,7 +268,7 @@ void stack_collect(void)
#if MACH_DEBUG
stack_finalize(stack);
#endif /* MACH_DEBUG */
- kmem_free(kernel_map, stack, KERNEL_STACK_SIZE);
+ kmem_free(kmem_map, stack, KERNEL_STACK_SIZE);
s = splsched();
stack_lock();