diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index dbc96d1611cd..69ca17ae7396 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1341,7 +1341,7 @@ thread_userret(struct thread *td, struct trapframe *frame) break; mtx_unlock_spin(&sched_lock); if (msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, - "maxthreads", 0)) { + "maxthreads", hz/10) != EWOULDBLOCK) { mtx_lock_spin(&sched_lock); break; } else { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 805979c8ecc3..ed788dae8c20 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -492,13 +492,6 @@ thread_exit(void) /* XXX first arg not used in 4BSD or ULE */ sched_exit_thread(FIRST_THREAD_IN_PROC(p), td); - /* - * as we are exiting there is room for another - * to be created. - */ - if (p->p_maxthrwaits) - wakeup(&p->p_numthreads); - /* * The test below is NOT true if we are the * sole exiting thread. P_STOPPED_SNGL is unset