As an aside, this is something I would like to address. I keep runninginto this pattern where I could do something in-line if I had a"can_sleep()" context. Otherwise, I have to punt to something like aworkqueue which adds latency. The closest thing I have to "can_sleep()"is preemptible(), which, as you correctly pointed out is limited to onlyworking with CONFIG_PREEMPT=y.

Its been a while since I looked into it, but one of the barriers thatwould need to be overcome is the fact that the preempt_count stuff getscompiled away with CONFIG_PREEMPT=n. It is conceivable that we couldmake the preempt_count logic an independent config variable fromCONFIG_PREEMPT to provide a can_sleep() macro without requiringfull-blow preemption to be enabled. So my questions would be as follows:

a) Is the community conducive to such an idea?b) Are there other things to consider/fix besides the lack ofpreempt_count in order to implement such a beast?