提交 8c703d35 编写于 作者: J Jonathan Corbet 提交者: Linus Torvalds

in_atomic(): document why it is unsuitable for general use

Discourage people from inappropriately using in_atomic()
Signed-off-by: NJonathan Corbet <corbet@lwn.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f67e74ca
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册