scheduler (sched_4bsd) questions

Peter Holm peter at holm.cc
Fri Oct 1 04:08:21 PDT 2004


On Fri, Oct 01, 2004 at 12:13:01AM -0400, Stephan Uphoff wrote:
> On Wed, 2004-09-29 at 18:14, Stephan Uphoff wrote:
> > I was looking at the MUTEX_WAKE_ALL undefined case when I used the
> > critical section for turnstile_claim().
> > However there are bigger problems with MUTEX_WAKE_ALL undefined
> > so you are right - the critical section for turnstile_claim is pretty
> > useless.
> 
> Arghhh !!!
> 
> MUTEX_WAKE_ALL is NOT an option in GENERIC.
> I recall verifying that it is defined twice. Guess I must have looked at
> the wrong source tree :-(
> This means yes - we have bigger problems!
> 
> Example:
> 
> Thread A holds a mutex x contested by Thread B and C and has priority
> pri(A).
> 
> Thread C holds a mutex y and pri(B) < pri(C)
> 
> Thread A releases the lock wakes thread B but lets C on the turnstile
> wait queue.
> 
> An interrupt thread I tries to lock mutex y owned by C.
> 
> However priority inheritance does not work since B needs to run first to
> take ownership of the lock.
> 
> I is blocked :-(
> 
> This was found using Peter Holm's test and a slight modification of this
> giant hog detector. (kern_clock.diff)
> 
> I definitely won't have time to fix kern_mutex.c for the next few days
> so please add the line:
> 
> options		MUTEX_WAKE_ALL		# Needed do not remove
> 

I like to test one thing at a time, so I added MUTEX_WAKE_ALL to HEAD from
Sep 30 09:58 UTC. This did not seem to change any thing :-(
I'll proceed with adding your switch_patch_v2 patch + your sched_4bsd.c patch,
but without MUTEX_WAKE_ALL.

- Peter

> to your configuration files.
> 
> I also had overlooked 
> 	 	http://www.holm.cc/stress/log/cons80.html
> Showing that my patch for kern_switch.c (switch_patch) has a bug.
> I will send an updated patch later today.
> 
> 	Stephan
> 
> PS: I love the firewire debugging speed!

-- 
Peter Holm


More information about the freebsd-arch mailing list