Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2005 16:00:41 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        src-committers@freebsd.org
Cc:        cvs-src@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/kern kern_synch.c src/sys/sys systm.h
Message-ID:  <200512291600.42686.jhb@freebsd.org>
In-Reply-To: <200512292057.jBTKvj7w082984@repoman.freebsd.org>
References:  <200512292057.jBTKvj7w082984@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 29 December 2005 03:57 pm, John Baldwin wrote:
> jhb         2005-12-29 20:57:45 UTC
>
>   FreeBSD src repository
>
>   Modified files:
>     sys/kern             kern_synch.c
>     sys/sys              systm.h
>   Log:
>   Add a new function msleep_spin() which is a slightly stripped down
> version of msleep().  msleep_spin() doesn't support changing the priority
> of the thread while it is asleep nor does it support interruptible sleeps
> (PCATCH) or the PDROP flag.  It does support timeouts however.  It differs
> from msleep() in that the passed in mutex is a spin mutex.  This means one
> can use msleep_spin() and wakeup() with a spin mutex similar to msleep()
> and wakeup() with a regular mutex.  Note that the spin mutex in question
> needs to come before sched_lock and the sleepq locks in lock order.

This is mostly useful for interfacing with code that must work with primary 
interrupt context.  For example, drivers that want to use an INTR_FAST 
handler that defers work to a taskqueue will need to use a taskqueue that 
uses spin locks and this is needed for taskqueue_drain() in that case.  I 
will probably also make use of this to cleanup callout_drain() so that it 
only uses the one spin mutex and loses the extra sleep mutex and the other 
trickery associated with it.

-- 
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?200512291600.42686.jhb>