patch for schedulers

From: Julian Elischer <julian_at_elischer.org>
Date: Tue, 14 Sep 2004 01:20:16 -0700
SOme people have reported threaded apps hanging and becoming unkillable.

If you have this problem in a reproducible way, please try the attached patch
and let me know if it helps.

Julian




Index: sys/kern/kern_switch.c
===========================================================================
--- sys/kern/kern_switch.c	2004/09/14 08:14:48	#76
+++ sys/kern/kern_switch.c	2004/09/14 08:14:48
_at__at_ -350,11 +389,10 _at__at_
 			}
 			kg->kg_avail_opennings = 1;
 		}
-		kg->kg_avail_opennings--;
 		sched_add(td, flags);
 		return;
 	}
 
 	tda = kg->kg_last_assigned;
 	if ((kg->kg_avail_opennings <= 0) &&
 	(tda && (tda->td_priority > td->td_priority))) {
_at__at_ -415,7 +449,6 _at__at_
 			td2 = TAILQ_NEXT(tda, td_runq);
 			kg->kg_last_assigned = td2;
 		}
-		kg->kg_avail_opennings--;
 		sched_add(td2, flags);
 	} else {
 		CTR3(KTR_RUNQ, "setrunqueue: held: td%p kg%p pid%d",
Index: sys/kern/sched_4bsd.c
===========================================================================
--- sys/kern/sched_4bsd.c	2004/09/14 08:14:48	#64
+++ sys/kern/sched_4bsd.c	2004/09/14 08:14:48
_at__at_ -1024,6 +1024,7 _at__at_
 	}
 	if ((td->td_proc->p_flag & P_NOLOAD) == 0)
 		sched_tdcnt++;
+	td->td_ksegrp->kg_avail_opennings--;
 	runq_add(ke->ke_runq, ke);
 	ke->ke_ksegrp->kg_runq_kses++;
 	ke->ke_state = KES_ONRUNQ;
Index: sys/kern/sched_ule.c
===========================================================================
--- sys/kern/sched_ule.c	2004/09/14 08:14:48	#127
+++ sys/kern/sched_ule.c	2004/09/14 08:14:48
_at__at_ -1773,6 +1773,7 _at__at_
 		curthread->td_flags |= TDF_NEEDRESCHED;
 	if (preemptive && maybe_preempt(td))
 		return;
+	td->td_ksegrp->kg_avail_opennings--;
 	ke->ke_ksegrp->kg_runq_threads++;
 	ke->ke_state = KES_ONRUNQ;
 
Received on Tue Sep 14 2004 - 06:20:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:11 UTC