Commit 557ab425 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched, tracing: Show PREEMPT_ACTIVE state in trace_sched_switch

We had need to see the difference between scheduling a runnable task and
a runnable task being involuntarily preempted.

No app should rely on the old string output (the binary
trace event record format is not changed).
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1316164603.10174.11.camel@twinsSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f4cfb33e
...@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p) ...@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p)
* For all intents and purposes a preempted task is a running task. * For all intents and purposes a preempted task is a running task.
*/ */
if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE) if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE)
state = TASK_RUNNING; state = TASK_RUNNING | TASK_STATE_MAX;
#endif #endif
return state; return state;
...@@ -137,13 +137,14 @@ TRACE_EVENT(sched_switch, ...@@ -137,13 +137,14 @@ TRACE_EVENT(sched_switch,
__entry->next_prio = next->prio; __entry->next_prio = next->prio;
), ),
TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_pid=%d next_prio=%d", TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d",
__entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
__entry->prev_state ? __entry->prev_state & (TASK_STATE_MAX-1) ?
__print_flags(__entry->prev_state, "|", __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|",
{ 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
{ 16, "Z" }, { 32, "X" }, { 64, "x" }, { 16, "Z" }, { 32, "X" }, { 64, "x" },
{ 128, "W" }) : "R", { 128, "W" }) : "R",
__entry->prev_state & TASK_STATE_MAX ? "+" : "",
__entry->next_comm, __entry->next_pid, __entry->next_prio) __entry->next_comm, __entry->next_pid, __entry->next_prio)
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment