![]() | ||||||||||
Messages in this thread Patch in this message |
Andrew Morton <akpm@linux-foundation.org> wrote: > It'd be better if the comment were to describe _why_ in_atomic() is > unreliable. ie: "does not account for held spinlocks on non-preemptible > kernels". But then...why would anybody have a reason to read the upcoming LWN article on the subject? OK, how's this? jon -- Discourage people from inappropriately using in_atomic() Signed-off-by: Jonathan Corbet <corbet@lwn.net> diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 4982998..63a7782 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -72,6 +72,13 @@ #define in_softirq() (softirq_count()) #define in_interrupt() (irq_count()) +/* + * Are we running in atomic context? WARNING: this macro cannot + * always detect atomic context; in particular, it cannot know about + * held spinlocks in non-preemptible kernels. Thus it should not be + * used in the general case to determine whether sleeping is possible. + * Do not use in_atomic() in driver code. + */ #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) #ifdef CONFIG_PREEMPT -- 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/ | |||||||||
| Last update: 2008-03-24 19:55 [W:0.339 / U:0.190 seconds] ©2003-2008 Jasper Spaans | ||||||||||