Date: Mon, 26 Aug 2013 22:03:41 +0300 From: Alexander Motin <mav@FreeBSD.org> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-projects@freebsd.org, Adrian Chadd <adrian@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org> Subject: Re: svn commit: r254846 - projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <521BA68D.3070304@FreeBSD.org> In-Reply-To: <201308261425.34743.jhb@freebsd.org> References: <201308251121.r7PBLA3v033536@svn.freebsd.org> <CAJ-VmomGUoQco04RCPuc1iA%2B1qecPqzBb_u8PBKiTL-Y0SaMkQ@mail.gmail.com> <521A06A2.7050807@FreeBSD.org> <201308261425.34743.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?521BA68D.3070304>