diff options
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r-- | sys/kern/kern_thread.c | 129 |
1 files changed, 2 insertions, 127 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index db6d71a..ec63f89 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -68,43 +68,12 @@ int max_threads_hits; SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD, &max_threads_hits, 0, ""); -#ifdef KSE -int virtual_cpu; - -#endif TAILQ_HEAD(, thread) zombie_threads = TAILQ_HEAD_INITIALIZER(zombie_threads); static struct mtx zombie_lock; MTX_SYSINIT(zombie_lock, &zombie_lock, "zombie lock", MTX_SPIN); static void thread_zombie(struct thread *); -#ifdef KSE -static int -sysctl_kse_virtual_cpu(SYSCTL_HANDLER_ARGS) -{ - int error, new_val; - int def_val; - - def_val = mp_ncpus; - if (virtual_cpu == 0) - new_val = def_val; - else - new_val = virtual_cpu; - error = sysctl_handle_int(oidp, &new_val, 0, req); - if (error != 0 || req->newptr == NULL) - return (error); - if (new_val < 0) - return (EINVAL); - virtual_cpu = new_val; - return (0); -} - -/* DEBUG ONLY */ -SYSCTL_PROC(_kern_threads, OID_AUTO, virtual_cpu, CTLTYPE_INT|CTLFLAG_RW, - 0, sizeof(virtual_cpu), sysctl_kse_virtual_cpu, "I", - "debug virtual cpus"); -#endif - struct mtx tid_lock; static struct unrhdr *tid_unrhdr; @@ -230,9 +199,6 @@ void proc_linkup(struct proc *p, struct thread *td) { -#ifdef KSE - TAILQ_INIT(&p->p_upcalls); /* upcall list */ -#endif sigqueue_init(&p->p_sigqueue, p); p->p_ksi = ksiginfo_alloc(1); if (p->p_ksi != NULL) { @@ -258,9 +224,6 @@ threadinit(void) thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(), thread_ctor, thread_dtor, thread_init, thread_fini, 16 - 1, 0); -#ifdef KSE - kseinit(); /* set up kse specific stuff e.g. upcall zone*/ -#endif } /* @@ -286,7 +249,7 @@ thread_stash(struct thread *td) } /* - * Reap zombie kse resource. + * Reap zombie resources. */ void thread_reap(void) @@ -311,9 +274,6 @@ thread_reap(void) td_first = td_next; } } -#ifdef KSE - upcall_reap(); -#endif } /* @@ -343,12 +303,7 @@ thread_alloc(void) void thread_free(struct thread *td) { -#ifdef KSE - if (td->td_cpuset != NULL) - cpuset_rel(td->td_cpuset); -#else cpuset_rel(td->td_cpuset); -#endif td->td_cpuset = NULL; cpu_thread_free(td); if (td->td_altkstack != 0) @@ -365,29 +320,7 @@ thread_free(struct thread *td) * Because we can't free a thread while we're operating under its context, * push the current thread into our CPU's deadthread holder. This means * we needn't worry about someone else grabbing our context before we - * do a cpu_throw(). This may not be needed now as we are under schedlock. - * Maybe we can just do a thread_stash() as thr_exit1 does. - */ -/* XXX - * libthr expects its thread exit to return for the last - * thread, meaning that the program is back to non-threaded - * mode I guess. Because we do this (cpu_throw) unconditionally - * here, they have their own version of it. (thr_exit1()) - * that doesn't do it all if this was the last thread. - * It is also called from thread_suspend_check(). - * Of course in the end, they end up coming here through exit1 - * anyhow.. After fixing 'thr' to play by the rules we should be able - * to merge these two functions together. - * - * called from: - * exit1() - * kse_exit() - * thr_exit() - * ifdef KSE - * thread_user_enter() - * thread_userret() - * endif - * thread_suspend_check() + * do a cpu_throw(). */ void thread_exit(void) @@ -413,17 +346,6 @@ thread_exit(void) AUDIT_SYSCALL_EXIT(0, td); #endif -#ifdef KSE - if (td->td_standin != NULL) { - /* - * Note that we don't need to free the cred here as it - * is done in thread_reap(). - */ - thread_zombie(td->td_standin); - td->td_standin = NULL; - } -#endif - umtx_thread_exit(td); /* @@ -453,11 +375,7 @@ thread_exit(void) if (p->p_flag & P_HADTHREADS) { if (p->p_numthreads > 1) { thread_lock(td); -#ifdef KSE - kse_unlink(td); -#else thread_unlink(td); -#endif thread_unlock(td); td2 = FIRST_THREAD_IN_PROC(p); sched_exit_thread(td2, td); @@ -480,16 +398,6 @@ thread_exit(void) } else { /* * The last thread is exiting.. but not through exit() - * what should we do? - * Theoretically this can't happen - * exit1() - clears threading flags before coming here - * kse_exit() - treats last thread specially - * thr_exit() - treats last thread specially - * ifdef KSE - * thread_user_enter() - only if more exist - * thread_userret() - only if more exist - * endif - * thread_suspend_check() - only if more exist */ panic ("thread_exit: Last thread exiting on its own"); } @@ -518,16 +426,6 @@ thread_wait(struct proc *p) mtx_assert(&Giant, MA_NOTOWNED); KASSERT((p->p_numthreads == 1), ("Multiple threads in wait1()")); td = FIRST_THREAD_IN_PROC(p); -#ifdef KSE - if (td->td_standin != NULL) { - if (td->td_standin->td_ucred != NULL) { - crfree(td->td_standin->td_ucred); - td->td_standin->td_ucred = NULL; - } - thread_free(td->td_standin); - td->td_standin = NULL; - } -#endif /* Lock the last thread so we spin until it exits cpu_throw(). */ thread_lock(td); thread_unlock(td); @@ -545,13 +443,6 @@ thread_wait(struct proc *p) * Link a thread to a process. * set up anything that needs to be initialized for it to * be used by the process. - * - * Note that we do not link to the proc's ucred here. - * The thread is linked as if running but no KSE assigned. - * Called from: - * proc_linkup() - * thread_schedule_upcall() - * thr_create() */ void thread_link(struct thread *td, struct proc *p) @@ -577,9 +468,6 @@ thread_link(struct thread *td, struct proc *p) /* * Convert a process with one thread to an unthreaded process. - * Called from: - * thread_single(exit) (called from execve and exit) - * kse_exit() XXX may need cleaning up wrt KSE stuff */ void thread_unthread(struct thread *td) @@ -587,20 +475,7 @@ thread_unthread(struct thread *td) struct proc *p = td->td_proc; KASSERT((p->p_numthreads == 1), ("Unthreading with >1 threads")); -#ifdef KSE - thread_lock(td); - upcall_remove(td); - thread_unlock(td); - p->p_flag &= ~(P_SA|P_HADTHREADS); - td->td_mailbox = NULL; - td->td_pflags &= ~(TDP_SA | TDP_CAN_UNBIND); - if (td->td_standin != NULL) { - thread_zombie(td->td_standin); - td->td_standin = NULL; - } -#else p->p_flag &= ~P_HADTHREADS; -#endif } /* |