What I'd like is a debugging function `can_sleep()'. This
is good for documentary purposes, and will catch bugs.
So kmalloc() would gain:
if (gfp_flags & __GFP_WAIT)
can_sleep() would do the following:
- If CONFIG_PREEMPT, check the locking depth (minus BKL depth),
whine if non-zero.
- If inside cli(), whine.
- If inside __cli(), also whine (not really a bug, but a design error).
- whining will include generation of a backtrace.
I suspect a 2.4 version would generate too many bug reports :)
It would have to implement its own lock depth accounting if
we want the sleep-inside-spinlock checking.
There's some arch-dependent stuff in there. I'll do a 2.5
patch. I suspect it'll generate showers of stuff. We can
feed fixes back into 2.4.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/