Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Jul 2001 11:14:46 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Matthew Jacob <mjacob@feral.com>
Cc:        Jake Burkholder <jake@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys systm.h condvar.h src/sys/kern kern_
Message-ID:  <XFMail.010704111446.jhb@FreeBSD.org>
In-Reply-To: <Pine.BSF.4.21.0107041036590.11969-100000@beppo>

next in thread | previous in thread | raw e-mail | index | archive | help

On 04-Jul-01 Matthew Jacob wrote:
>> but I can see the state of the subsytem being altered by another CPU
>> before the wakeup is delivered (since the lock is unlocked and we
>> may preempt on lock release and thus alter the state of the locked
>> subsytem before coming back to the original thread and doing the
>> wakeup) resulting in possibly bogus wakeups being sent.  Yuck.
> 
> Sigh.

Note that the preemption on lock release isn't the only way, interrupts can
come in at any inopportune time and screw things up.
 
>> > I can see that it's possible you could get contention if the cv_signal
>> > or wakeup causes a reschedule on another CPU right away. Is there any
>> > empirical measurements showing this happening?
>> 
>> If a CPU is idle this can easily happen.  In a fully preeemptive
>> kernel where wakeup (well, setrunqueue) will switch to the new
>> process that it just woke up if it is higher priority than the
>> current one it can easily happen as well.
> 
> Well, it seemed like creeping featurism, but it is probably okay.
> Although it *does* seem to me that if you do:
> 
>       wakeup
>       unlock
> 
> in your code, I find it hard to believe that you will contention *after*
> the wakeup but before the unlock except in the pre-emption case. That's
> why I asked for some empirical data.

You will get it in the SMP case as well.  Preemption and SMP are the same
environment.

> -matt

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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