summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-08-29 13:28:02 +0000
committerkib <kib@FreeBSD.org>2009-08-29 13:28:02 +0000
commit9e8ade6852ffba4a3acbce8ed04b15b86e41c732 (patch)
tree82b12109af3318558a1e8c250b9fe6dbbb1bb53d /sys/kern/kern_proc.c
parent13a2f00901be2c2864e1b4b96d70fecffd1d5c4c (diff)
downloadFreeBSD-src-9e8ade6852ffba4a3acbce8ed04b15b86e41c732.zip
FreeBSD-src-9e8ade6852ffba4a3acbce8ed04b15b86e41c732.tar.gz
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
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index cdbc012..e012a3e 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -203,14 +203,6 @@ proc_dtor(void *mem, int size, void *arg)
#endif
/* Free all OSD associated to this thread. */
osd_thread_exit(td);
-
- /* Dispose of an alternate kstack, if it exists.
- * XXX What if there are more than one thread in the proc?
- * The first thread in the proc is special and not
- * freed, so you gotta do this here.
- */
- if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0))
- vm_thread_dispose_altkstack(td);
}
EVENTHANDLER_INVOKE(process_dtor, p);
if (p->p_ksi != NULL)
@@ -767,8 +759,6 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp)
FOREACH_THREAD_IN_PROC(p, td0) {
if (!TD_IS_SWAPPED(td0))
kp->ki_rssize += td0->td_kstack_pages;
- if (td0->td_altkstack_obj != NULL)
- kp->ki_rssize += td0->td_altkstack_pages;
}
kp->ki_swrss = vm->vm_swrss;
kp->ki_tsize = vm->vm_tsize;
OpenPOWER on IntegriCloud