summaryrefslogtreecommitdiff
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2011-09-29 12:24:30 -0500
committerClark Williams <williams@redhat.com>2011-12-28 16:25:20 -0600
commit7356cbb6241e563fdbc1164d1e88fb333f101dd7 (patch)
treec0783bf3993666adf830051f9824d00d4b794b19 /kernel/sched.c
parent249cc89f933aa59b9945c88588d191743694670d (diff)
tracing: Account for preempt off in preempt_schedule()
The preempt_schedule() uses the preempt_disable_notrace() version because it can cause infinite recursion by the function tracer as the function tracer uses preempt_enable_notrace() which may call back into the preempt_schedule() code as the NEED_RESCHED is still set and the PREEMPT_ACTIVE has not been set yet. See commit: d1f74e20b5b064a130cd0743a256c2d3cfe84010 that made this change. The preemptoff and preemptirqsoff latency tracers require the first and last preempt count modifiers to enable tracing. But this skips the checks. Since we can not convert them back to the non notrace version, we can use the idle() hooks for the latency tracers here. That is, the start/stop_critical_timings() works well to manually start and stop the latency tracer for preempt off timings. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Clark Williams <williams@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index a39494ea51e7..6b3239590d5a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4520,7 +4520,16 @@ asmlinkage void __sched notrace preempt_schedule(void)
do {
add_preempt_count_notrace(PREEMPT_ACTIVE);
+ /*
+ * The add/subtract must not be traced by the function
+ * tracer. But we still want to account for the
+ * preempt off latency tracer. Since the _notrace versions
+ * of add/subtract skip the accounting for latency tracer
+ * we must force it manually.
+ */
+ start_critical_timings();
__schedule();
+ stop_critical_timings();
sub_preempt_count_notrace(PREEMPT_ACTIVE);
/*