So, to return to my original question... local_bh_count() > 0 when
a BH is running or after local_bh_disable(). local_irq_count() > 0 in
interrupt context, but not necessarily when interrupts are disabled.
This makes checks like the following (in alloc_skb) asymmetric:
if (in_interrupt() && (gfp_mask & __GFP_WAIT)) {
static int count = 0;
if (++count < 5) {
printk(KERN_ERR "alloc_skb called nonatomically "
"from interrupt %p\n", NET_CALLER(size));
BUG();
In a driver I'm writing, this bug was hidden until I switched from using
write_lock_irqsave() to write_lock_bh(). Shouldn't this bug also be
announced if interrupts are disabled? (I understand that disabling bh/irq
in the correct order will ensure that this bug is properly detected, but
it seems like a strange policy to rely on correct coding to catch a bug.)
-- Dan Eble <dane@aiinet.com> _____ . | _ |/| Applied Innovation Inc. | |_| | | http://www.aiinet.com/ |__/|_|_|- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/