From owner-freebsd-current@FreeBSD.ORG Sun Aug 10 00:03:19 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F3FCF37B401; Sun, 10 Aug 2003 00:03:18 -0700 (PDT) Received: from fepX.post.tele.dk (fepx.post.tele.dk [195.41.46.234]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73EAE43F3F; Sun, 10 Aug 2003 00:03:15 -0700 (PDT) (envelope-from pho@holm.cc) Received: from peter.osted.lan ([80.164.63.151]) by fepX.post.tele.dk (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP id <20030810070313.RHGB20854.fepX.post.tele.dk@peter.osted.lan>; Sun, 10 Aug 2003 09:03:13 +0200 Received: from peter.osted.lan (localhost [127.0.0.1]) by peter.osted.lan (8.12.8/8.12.8) with ESMTP id h7A73DZN097503; Sun,: 03:13 +0200 (CEST) (envelope-from pho@peter.osted.lan) Received: (from pho@localhost) by peter.osted.lan (8.12.8/8.12.8/Submit) id h7A73Cmt097502; Sun,: 03:12 +0200 (CEST) Date: Sun, 10 Aug 2003 09:03:12 +0200 From: Peter Holm To: freebsd-current@freebsd.org Message-ID: <20030810070311.GA97363@peter.osted.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline User-Agent: Mutt/1.4i Subject: Deadlock [PATCH] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2003 07:03:19 -0000 --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--