svn commit: r254846 - projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Alexander Motin mav at FreeBSD.org
Mon Aug 26 19:03:48 UTC 2013


On 26.08.2013 21:25, John Baldwin wrote:
> On Sunday, August 25, 2013 9:29:06 am Alexander Motin wrote:
>> On 25.08.2013 15:48, Adrian Chadd wrote:
>>> Surely there's a better way to check whether a thread can sleep besides
>>> digging around in curthread->td_no_sleeping ? What about adding an
>>> accessor macro along side THREAD_SLEEPING_OK and THREAD_NO_SLEEPING ?
>>
>> That sounds good to me. I was also surprised such macros are not there
>> yet when found some code doing these checks just the same way as I did.
>
> It was never intended to be public, only as a debugging aid for assertions. :(
> I had hoped that the calling code would know when it was in an ithread or not
> and call different routines as needed (i.e. that the programmer would
> intentionally think about the context they were in).  Perhaps this is not
> realistic?  Are you really queueing new I/O from ithreads and/or timers?

I don't, but at least GEOM SCHED I think does it from callout context.
I agree that caller code should usually know where it runs, and in such 
case it can control whether execute request directly or queue it. But 
queued requests are executed by GEOM threads, where sleeping is also 
denied for callee, i.e. not really much different. Same time zvol can 
benefit very much from ability to sleep in caller context, that I've 
implemented with this check. If not do it that way, I could replace that 
with check for whether we run explicitly from one of GEOM threads. That 
I think should be sufficient.

-- 
Alexander Motin


More information about the svn-src-projects mailing list