Date: Thu, 30 Sep 2004 14:30:51 -0400 From: Stephan Uphoff <ups@tree.com> To: John Baldwin <jhb@FreeBSD.org> Cc: "freebsd-arch@freebsd.org" <freebsd-arch@FreeBSD.org> Subject: Re: scheduler (sched_4bsd) questions Message-ID: <1096569051.21577.23.camel@palm.tree.com> In-Reply-To: <200409301017.54350.jhb@FreeBSD.org> References: <1095468747.31297.241.camel@palm.tree.com> <200409291652.29990.jhb@FreeBSD.org> <1096496057.3733.2163.camel@palm.tree.com> <200409301017.54350.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2004-09-30 at 10:17, John Baldwin wrote: > Fair enough. The right place to fix this is in turnstile_unpend() though I > think. I have had these patches that try to "clump" setrunqueue's before > preempting lying around (but not thoroughly tested yet) that might fix this > as well but in the turnstile code itself: - snip - > --- //depot/projects/smpng/sys/kern/subr_turnstile.c 2004/09/03 14:14:21 > +++ //depot/user/jhb/preemption/kern/subr_turnstile.c 2004/09/10 21:36:10 > @@ -727,6 +726,7 @@ > * in turnstile_wait(). Set a flag to force it to try to acquire > * the lock again instead of blocking. > */ > + critical_enter(); > while (!TAILQ_EMPTY(&pending_threads)) { > td = TAILQ_FIRST(&pending_threads); > TAILQ_REMOVE(&pending_threads, td, td_lockq); > @@ -742,6 +742,7 @@ > MPASS(TD_IS_RUNNING(td) || TD_ON_RUNQ(td)); > } > } > + critical_exit(); > mtx_unlock_spin(&sched_lock); > } -snip - > > I.e., you could just move the critical_enter() in subr_turnstile.c earlier so > it is before the mtx_unlock_spin() of the turnstile chain lock. I agree - this would be the right place. I was originally planning to do some more work in kern_mutex and did not want to touch more than one file ;-) Can you check this in? Your other patches look like they are targeted to avoid senseless switching to improve performance - but should not have an impact on correct function. Right ? Hopefully I get some time to look at them more closely later on. Stephan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1096569051.21577.23.camel>