summaryrefslogtreecommitdiffstats
path: root/include/linux/preempt.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2011-06-08 01:13:27 +0200
committerFrederic Weisbecker <fweisbec@gmail.com>2011-06-10 15:15:40 +0200
commitbdd4e85dc36cdbcfc1608a5b2a17c80a9db8986a (patch)
tree9cee98e78a5aa6a00f3b7ce805b1e39a0137b4a4 /include/linux/preempt.h
parent2da8c8bc44b572cbf623629ff736608dc7968436 (diff)
downloadop-kernel-dev-bdd4e85dc36cdbcfc1608a5b2a17c80a9db8986a.zip
op-kernel-dev-bdd4e85dc36cdbcfc1608a5b2a17c80a9db8986a.tar.gz
sched: Isolate preempt counting in its own config option
Create a new CONFIG_PREEMPT_COUNT that handles the inc/dec of preempt count offset independently. So that the offset can be updated by preempt_disable() and preempt_enable() even without the need for CONFIG_PREEMPT beeing set. This prepares to make CONFIG_DEBUG_SPINLOCK_SLEEP working with !CONFIG_PREEMPT where it currently doesn't detect code that sleeps inside explicit preemption disabled sections. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'include/linux/preempt.h')
-rw-r--r--include/linux/preempt.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 2e681d9..58969b2 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -27,6 +27,21 @@
asmlinkage void preempt_schedule(void);
+#define preempt_check_resched() \
+do { \
+ if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
+ preempt_schedule(); \
+} while (0)
+
+#else /* !CONFIG_PREEMPT */
+
+#define preempt_check_resched() do { } while (0)
+
+#endif /* CONFIG_PREEMPT */
+
+
+#ifdef CONFIG_PREEMPT_COUNT
+
#define preempt_disable() \
do { \
inc_preempt_count(); \
@@ -39,12 +54,6 @@ do { \
dec_preempt_count(); \
} while (0)
-#define preempt_check_resched() \
-do { \
- if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
- preempt_schedule(); \
-} while (0)
-
#define preempt_enable() \
do { \
preempt_enable_no_resched(); \
@@ -80,18 +89,17 @@ do { \
preempt_check_resched(); \
} while (0)
-#else
+#else /* !CONFIG_PREEMPT_COUNT */
#define preempt_disable() do { } while (0)
#define preempt_enable_no_resched() do { } while (0)
#define preempt_enable() do { } while (0)
-#define preempt_check_resched() do { } while (0)
#define preempt_disable_notrace() do { } while (0)
#define preempt_enable_no_resched_notrace() do { } while (0)
#define preempt_enable_notrace() do { } while (0)
-#endif
+#endif /* CONFIG_PREEMPT_COUNT */
#ifdef CONFIG_PREEMPT_NOTIFIERS
OpenPOWER on IntegriCloud