From: Michael Jeanson Date: Mon, 4 Apr 2022 17:52:57 +0000 (-0400) Subject: fix: sched/tracing: Don't re-read p->state when emitting sched_switch event (v5.18) X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=8e52fd71e693619f7a58de2692e59f0c826e9988;hp=8e52fd71e693619f7a58de2692e59f0c826e9988;p=lttng-modules.git fix: sched/tracing: Don't re-read p->state when emitting sched_switch event (v5.18) See upstream commit : commit fa2c3254d7cfff5f7a916ab928a562d1165f17bb Author: Valentin Schneider Date: Thu Jan 20 16:25:19 2022 +0000 sched/tracing: Don't re-read p->state when emitting sched_switch event As of commit c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") the following sequence becomes possible: p->__state = TASK_INTERRUPTIBLE; __schedule() deactivate_task(p); ttwu() READ !p->on_rq p->__state=TASK_WAKING trace_sched_switch() __trace_sched_switch_state() task_state_index() return 0; TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in the trace event. Prevent this by pushing the value read from __schedule() down the trace event. Change-Id: I46743cd006be4b4d573cae2d77df7d6d16744d04 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers ---