Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/fair: Fix pelt clock sync when entering idle

Samuel and Alex reported regressions of the util_avg of RT rq with
commit 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection").
It happens that fair is updating and syncing the pelt clock with task one
when pick_next_task_fair() fails to pick a task but before the prev
scheduling class got a chance to update its pelt signals.

Move update_idle_rq_clock_pelt() in set_next_task_idle() which is called
after prev class has been called.

Fixes: 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection")
Closes: https://lore.kernel.org/all/CAG2KctpO6VKS6GN4QWDji0t92_gNBJ7HjjXrE+6H+RwRXt=iLg@mail.gmail.com/
Closes: https://lore.kernel.org/all/8cf19bf0e0054dcfed70e9935029201694f1bb5a.camel@mediatek.com/
Reported-by: Samuel Wu <wusamuel@google.com>
Reported-by: Alex Hoh <Alex.Hoh@mediatek.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Samuel Wu <wusamuel@google.com>
Tested-by: Alex Hoh <Alex.Hoh@mediatek.com>
Link: https://patch.msgid.link/20260121163317.505635-1-vincent.guittot@linaro.org

authored by

Vincent Guittot and committed by
Peter Zijlstra
98c88dc8 24d479d2

+6 -6
-6
kernel/sched/fair.c
··· 8995 8995 goto again; 8996 8996 } 8997 8997 8998 - /* 8999 - * rq is about to be idle, check if we need to update the 9000 - * lost_idle_time of clock_pelt 9001 - */ 9002 - update_idle_rq_clock_pelt(rq); 9003 - 9004 8998 return NULL; 9005 8999 } 9006 9000
+6
kernel/sched/idle.c
··· 468 468 scx_update_idle(rq, true, true); 469 469 schedstat_inc(rq->sched_goidle); 470 470 next->se.exec_start = rq_clock_task(rq); 471 + 472 + /* 473 + * rq is about to be idle, check if we need to update the 474 + * lost_idle_time of clock_pelt 475 + */ 476 + update_idle_rq_clock_pelt(rq); 471 477 } 472 478 473 479 struct task_struct *pick_task_idle(struct rq *rq, struct rq_flags *rf)