summaryrefslogtreecommitdiff
path: root/include/linux/hardirq.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-07-09 20:51:58 +0400
committerIngo Molnar <mingo@elte.hu>2007-07-09 20:51:58 +0400
commit4da1ce6d9c7e2a6d9236bf4dcfd33cf506082794 (patch)
tree28f1d0b2923900b6c41a60e6c45e50f1b3f15af3 /include/linux/hardirq.h
parentf64f61145a38f7039e4f1c0b50dcc3fbe70ec28e (diff)
downloadlinux-4da1ce6d9c7e2a6d9236bf4dcfd33cf506082794.tar.xz
sched: add in_atomic_preempt_off()
add in_atomic_preempt_off() - debugging helper that will simplify schedule(). Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/hardirq.h')
-rw-r--r--include/linux/hardirq.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 7803014f3a11..8d302298a161 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -79,6 +79,19 @@
#endif
#ifdef CONFIG_PREEMPT
+# define PREEMPT_CHECK_OFFSET 1
+#else
+# define PREEMPT_CHECK_OFFSET 0
+#endif
+
+/*
+ * Check whether we were atomic before we did preempt_disable():
+ * (used by the scheduler)
+ */
+#define in_atomic_preempt_off() \
+ ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
+
+#ifdef CONFIG_PREEMPT
# define preemptible() (preempt_count() == 0 && !irqs_disabled())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else