[PATCH v4 0/2] sched/fair: Fix fair load state when switching to fair
From: Zicheng Qu
Date: Wed Jun 24 2026 - 05:41:20 EST
Tasks outside fair may leave fair's sched_entity load state stale when
they switch back to fair. Patch 1 rebuilds p->se.load from fair's
switching_to hook, as in v3. Patch 2 keeps se->avg.load_avg in sync
with the rebuilt load weight before the entity is attached back to fair.
Changes in v4:
- Add Tejun's Acked-by to patch 1.
- Split the PELT load_avg synchronization into patch 2.
Changes in v3:
- Move the rebuild into fair's switching_to hook, as suggested by Peter.
This lets fair prepare its own state before enqueue and avoids adding a
sched_ext/fair-specific fixup to the generic sched_change_end() path.
Changes in v2:
- Move the fix from scx_root_disable() to the class switch path so it also
covers partial-mode SCHED_EXT to SCHED_NORMAL transitions through
sched_setscheduler(). Andrea identified this missing case in the v1
discussion.
Zicheng Qu (2):
sched/fair: Rebuild load weight when switching to fair
sched/fair: Keep load_avg in sync after reweighting
kernel/sched/fair.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
--
2.53.0