Date: Wed, 29 Sep 2004 16:26:16 -0400 From: Stephan Uphoff <ups@tree.com> To: Peter Holm <peter@holm.cc> Cc: "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org> Subject: Re: scheduler (sched_4bsd) questions Message-ID: <1096489576.3733.1868.camel@palm.tree.com> In-Reply-To: <1096477932.3733.1471.camel@palm.tree.com> References: <1095468747.31297.241.camel@palm.tree.com> <1095529353.31297.1192.camel@palm.tree.com> <1096135220.53798.17754.camel@palm.tree.com> <20040926075218.GA85983@peter.osted.lan> <1096339936.3733.279.camel@palm.tree.com> <20040928074926.GA99957@peter.osted.lan> <1096383103.3733.312.camel@palm.tree.com> <20040929085748.GA19695@peter.osted.lan> <1096467843.3733.1145.camel@palm.tree.com> <1096477932.3733.1471.camel@palm.tree.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-MHoXvfgwm/AM79gvF4x9 Content-Type: text/plain Content-Transfer-Encoding: 7bit Forgot to attach the patch ... Stephan On Wed, 2004-09-29 at 13:12, Stephan Uphoff wrote: > On Wed, 2004-09-29 at 10:24, Stephan Uphoff wrote: > > On Wed, 2004-09-29 at 04:57, Peter Holm wrote: > > > It's hard for me to tell if your patch has made any difference. > > > The freeze is still there. I'll try to make the same test once more > > > without your patches to see if I get the same pattern in freezes. > > > > I found some problems yesterday with mutex priority inheritance that > > could potentially cause your freeze patterns. > > > > I will try to roll a preliminary patch as soon as the caffeine does its > > magic. > > OK - here is a crude patch to fix some problems with mutex priority > inheritance. My theory is that the clock thread gets stuck waiting on > GIANT. > > During release/acquisition of a contested sleep mutex there are a few > windows where a task can be preempted when actions (waking up blocked > threads, ownership of the mutex, ..) need to be atomic as far as > scheduling is concerned. Otherwise priority inheritance may fail. The > patch uses critical_enter/critical_exit to protect these regions against > preemption. > > It would be great if could run this in addition to the other patches. > > Stephan --=-MHoXvfgwm/AM79gvF4x9 Content-Disposition: attachment; filename=mutex_patch Content-Type: text/x-patch; name=mutex_patch; charset=ASCII Content-Transfer-Encoding: 7bit Index: kern_mutex.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_mutex.c,v retrieving revision 1.149 diff -u -r1.149 kern_mutex.c --- kern_mutex.c 2 Sep 2004 18:59:15 -0000 1.149 +++ kern_mutex.c 29 Sep 2004 16:50:36 -0000 @@ -492,7 +492,9 @@ if (v == MTX_CONTESTED) { MPASS(ts != NULL); m->mtx_lock = (uintptr_t)td | MTX_CONTESTED; + critical_enter(); turnstile_claim(ts); + critical_exit(); break; } #endif @@ -651,6 +653,9 @@ #else MPASS(ts != NULL); #endif + + critical_enter(); + #ifndef PREEMPTION /* XXX */ td1 = turnstile_head(ts); @@ -671,6 +676,7 @@ } #endif turnstile_unpend(ts); + critical_exit(); #ifndef PREEMPTION /* --=-MHoXvfgwm/AM79gvF4x9--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1096489576.3733.1868.camel>