Deadlock [PATCH]
Peter Holm
peter at holm.cc
Sun Aug 10 00:03:19 PDT 2003
I have tracked down, what I belive to be the cause of several
deadlock situations I have encountered, like
http://people.freebsd.org/~pho/stress/cons40.html.
The problem seems to be the 4bsd scheduler, that does not preempt correctly.
I've included a patch that fixes the problem for me.
--
Peter Holm
-------------- next part --------------
--- sched_4bsd.c~ Sun Jun 15 16:57:17 2003
+++ sched_4bsd.c Sun Aug 10 08:41:06 2003
@@ -448,7 +448,8 @@
ke->ke_sched->ske_cpticks++;
kg->kg_estcpu = ESTCPULIM(kg->kg_estcpu + 1);
- if ((kg->kg_estcpu % INVERSE_ESTCPU_WEIGHT) == 0) {
+ if (((kg->kg_estcpu + 1) % INVERSE_ESTCPU_WEIGHT) == 0) {
+ curthread->td_flags |= TDF_NEEDRESCHED;
resetpriority(kg);
if (td->td_priority >= PUSER)
td->td_priority = kg->kg_user_pri;
More information about the freebsd-current
mailing list