diff options
| author | Jonathan Corbet <corbet@lwn.net> | 2008-03-28 17:15:49 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-28 17:45:21 -0400 |
| commit | 8c703d35fa91911dd92a18c31a718853f483ad80 (patch) | |
| tree | 13b63c9754ad202cc7f4528ee94c7c54f3f88bba /include | |
| parent | f67e74ca690d9f168cc468b7d714caad492740a6 (diff) | |
in_atomic(): document why it is unsuitable for general use
Discourage people from inappropriately using in_atomic()
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/hardirq.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 49829988bfa..897f723bd22 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -72,6 +72,13 @@ | |||
| 72 | #define in_softirq() (softirq_count()) | 72 | #define in_softirq() (softirq_count()) |
| 73 | #define in_interrupt() (irq_count()) | 73 | #define in_interrupt() (irq_count()) |
| 74 | 74 | ||
| 75 | /* | ||
| 76 | * Are we running in atomic context? WARNING: this macro cannot | ||
| 77 | * always detect atomic context; in particular, it cannot know about | ||
| 78 | * held spinlocks in non-preemptible kernels. Thus it should not be | ||
| 79 | * used in the general case to determine whether sleeping is possible. | ||
| 80 | * Do not use in_atomic() in driver code. | ||
| 81 | */ | ||
| 75 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) | 82 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) |
| 76 | 83 | ||
| 77 | #ifdef CONFIG_PREEMPT | 84 | #ifdef CONFIG_PREEMPT |
