Possible fix for KSE threads that never wake up

John Baldwin jhb at FreeBSD.org
Tue Oct 12 12:56:30 PDT 2004


Currently the KSE code arbitrarily sets the SLEEPING inhibitor on any thread 
it suspends that is on the sleep queue.  Threads that are on the sleep queue 
however are not always asleep and it adds needless complication and 
opportunity for bugs (if the inhibitor is not otherwise cleared the thread 
may never get to run again).  Since the suspension code uses its own 
inhibitor the hack isn't even needed.  This patch just turns it off.  Let me 
know if this fixes any problems people are seeing:

--- //depot/projects/smpng/sys/kern/kern_thread.c	2004/10/12 19:09:56
+++ //depot/user/jhb/preemption/kern/kern_thread.c	2004/10/12 19:26:23
@@ -999,6 +999,7 @@
 	p->p_suspcount++;
 	TD_SET_SUSPENDED(td);
 	TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq);
+#if 0
 	/*
 	 * Hack: If we are suspending but are on the sleep queue
 	 * then we are in msleep or the cv equivalent. We
@@ -1007,6 +1008,7 @@
 	 */
 	if (TD_ON_SLEEPQ(td))
 		TD_SET_SLEEPING(td);
+#endif
 }
 
 void

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-current mailing list