scx/scheds/rust/scx_lavd/src
Tejun Heo 625bb84bc4 scx_lavd: Move load subtraction to quiescent state transition
scx_lavd tracks task state transitions and updates statistics on each valid
transition. However, there's an asymmetry between the runnable/running and
stopping/quiescent transitions. In the former, the runnable and running
transitions are accounted separately in update_stat_for_enq() and
update_stat_for_run(), respectively. However, in the latter, the two
transitions are combined together in update_stat_for_stop().

This asymmetry leads to incorrect accounting. For example, a task's load
should be added to the cpu's load sum when the task gets enqueued and
subtracted when the task is no longer runnable (quiescent). The former is
accounted correctly from update_stat_for_enq() but the latter is done
whenever the task stops. A task can transit between running and stopping
multiple times before becoming quiescent, so the asymmetry can end up
subtracting the load of a task which is still running from the cpu's load
sum.

This patch:

- introduces LAVD_TASK_STAT_QUIESCENT and updates transit_task_stat() so
  that it can handle all valid state transitions including the multiple back
  and forth transitions between two pairs - QUIESCENT <-> ENQ and RUNNING
  <-> STOPPING.

- restores the symmetry by moving load adjustments part from
  update_stat_for_stop() to new update_stat_for_quiescent().

This removes a good chunk of ignored transitions. The next patch will take
care of the rest.
2024-03-26 12:23:19 -10:00
..
bpf scx_lavd: Move load subtraction to quiescent state transition 2024-03-26 12:23:19 -10:00
bpf_intf.rs scx_lavd: add scx_lavd (Latency-criticality Aware Virtual Deadline) scheduler 2024-03-16 10:31:07 +09:00
bpf_skel.rs scx_lavd: add scx_lavd (Latency-criticality Aware Virtual Deadline) scheduler 2024-03-16 10:31:07 +09:00
main.rs scx_lavd: Drop unnecessary extern crates 2024-03-26 12:23:19 -10:00