svn commit: r308424 - head/sys/arm/broadcom/bcm2835

Hans Petter Selasky hps at selasky.org
Thu Nov 10 07:47:02 UTC 2016


Hi,

On 11/09/16 17:32, John Baldwin wrote:
> It isn't predicted and avoided by turnstiles.  In particular, the cv_signal has
> no idea what lock is associated, so it can't try to do something "smart" and
> move the thread from the sleepq to the lockq.  You will pay the double context
> switch.

Maybe this is an idea for a turnstile optimisation? In another embedded 
OS based on FreeBSD I did exactly this. If someone is sleeping through 
cv_wait() the lock it is sleeping on, if different from NULL, is stored 
in the sleepqueue. When cv_signal() is invoked we simply check if the 
saved lock is owned by the caller and then don't do the pre-emption, 
because we predict it will be locked by cv_wait() before returning.

--HPS


More information about the svn-src-all mailing list