Fix: update sched instrumentation for kernel 4.4.0
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 27 Nov 2015 19:57:44 +0000 (14:57 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 27 Nov 2015 19:58:31 +0000 (14:58 -0500)
Due to upstream Linux kernel commit:

commit c73464b1c8434ad4cbfd5369c3e724f3e8ffe5a4
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Mon Sep 28 18:06:56 2015 +0200

    sched/core: Fix trace_sched_switch()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/sched.h

index 2efff161949556a294e72085ed2e5e7ed0ca6a60..f23db75b8bcc0c0ae9e4a68225405d5b061aade8 100644 (file)
 #ifndef _TRACE_SCHED_DEF_
 #define _TRACE_SCHED_DEF_
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0))
+
+static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p)
+{
+#ifdef CONFIG_SCHED_DEBUG
+       BUG_ON(p != current);
+#endif /* CONFIG_SCHED_DEBUG */
+       /*
+        * Preemption ignores task state, therefore preempted tasks are always RUNNING
+        * (we will not have dequeued if state != RUNNING).
+        */
+       return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state;
+}
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
 
 static inline long __trace_sched_switch_state(struct task_struct *p)
 {
@@ -228,7 +242,13 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup_new,
  */
 LTTNG_TRACEPOINT_EVENT(sched_switch,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0))
+       TP_PROTO(bool preempt,
+                struct task_struct *prev,
+                struct task_struct *next),
+
+       TP_ARGS(preempt, prev, next),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
        TP_PROTO(struct task_struct *prev,
                 struct task_struct *next),
 
@@ -244,7 +264,9 @@ LTTNG_TRACEPOINT_EVENT(sched_switch,
                ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
                ctf_integer(pid_t, prev_tid, prev->pid)
                ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0))
+               ctf_integer(long, prev_state, __trace_sched_switch_state(preempt, prev))
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
                ctf_integer(long, prev_state, __trace_sched_switch_state(prev))
 #else
                ctf_integer(long, prev_state, prev->state)
This page took 0.026847 seconds and 4 git commands to generate.