Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2004 16:52:29 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        freebsd-arch@FreeBSD.org
Cc:        Stephan Uphoff <ups@tree.com>
Subject:   Re: scheduler (sched_4bsd) questions
Message-ID:  <200409291652.29990.jhb@FreeBSD.org>
In-Reply-To: <1096489576.3733.1868.camel@palm.tree.com>
References:  <1095468747.31297.241.camel@palm.tree.com> <1096477932.3733.1471.camel@palm.tree.com> <1096489576.3733.1868.camel@palm.tree.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 29 September 2004 04:26 pm, Stephan Uphoff wrote:
> 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.

turnstile_claim() doesn't make any threads runnable and thus can't preempt.
The other place is supposed to preempt, and it should be ok to do so.  Note 
that since the turnstile chain lock is held, that includes a nested critical 
section and any preemption will be deferred until the turnstile lock is 
released via turnstile_release which happens in the middle of 
turnstile_unpend() after it has finished building a list of all the threads 
to be made runnable so that the turnstile object can be re-used safely.  I 
don't think this patch will make much of a difference (if any).  Can you 
provide a description of a case where you think the priority inheritance can 
fail if turnstile_unpend() doesn't run in a nested critical section?

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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