Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Aug 2003 09:03:12 +0200
From:      Peter Holm <peter@holm.cc>
To:        freebsd-current@freebsd.org
Subject:   Deadlock [PATCH]
Message-ID:  <20030810070311.GA97363@peter.osted.lan>

next in thread | raw e-mail | index | archive | help

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sched_4bsd.diff"

--- 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;

--OXfL5xGRrasGEqWY--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030810070311.GA97363>