fix: sched/tracing: Don't re-read p->state when emitting sched_switch event (v5.18)
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 4 Apr 2022 17:52:57 +0000 (13:52 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 7 Apr 2022 19:12:03 +0000 (15:12 -0400)
commit8e52fd71e693619f7a58de2692e59f0c826e9988
treed2de77b3ab8b1c157dd532706c9d78ce46b121e4
parenta7eb2e3d0a4beb1ee80b132927641dd05ef2d542
fix: sched/tracing: Don't re-read p->state when emitting sched_switch event (v5.18)

See upstream commit :

  commit fa2c3254d7cfff5f7a916ab928a562d1165f17bb
  Author: Valentin Schneider <valentin.schneider@arm.com>
  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 <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/instrumentation/events/sched.h
This page took 0.026095 seconds and 4 git commands to generate.