in_softirq() question

Timur Tabi (ttabi@interactivesi.com)
Wed, 17 Oct 2001 17:54:57 -0500


I'm writing a module that needs to synchronize with its own tasklet (bottom
half). Basically, I need to disable the bottom half whenever the driver has
been called to do some work. The tasklet is just a periodic timer that keeps
the hardware awake, but it should never pre-empty the driver itself.

To do this, I have added local_bh_disable() calls at the top of every entry
point in my driver. This works very well. However, I would add to like
additional checks to make sure that various code is not executed whenever
bottom halves are disabled.

I discovered function in_softirq(), but I'm having a hard time understanding
it. There's no documentation for it (not even any comments!), and the modules
in the kernel that do use it don't explain it either.

The code for in_softirq() makes me think that it returns non-zero if any
thread on this CPU has called local_bh_disable(), which is what I want. But
what does in_softirq() means? If I call local_bh_disable(), soft IRQs are
disabled, are they not? Isn't that what a bottom-half is, a soft IRQ?

-
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/