* [PATCH] sched/fair: Use the task's cfs_rq for PELT on delayed wakeup
@ 2026-12-04 12:20 Chuyi Zhou
2026-12-04 18:02 ` Kayra Cizmeci
2026-12-04 23:33 ` Peter Zijlstra
0 siblings, 2 replies; 3+ messages in thread
From: Chuyi Zhou @ 2026-12-04 12:20 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, vschneid, kprateek.nayak
Cc: linux-kernel, Chuyi Zhou
A task's PELT averages are tracked on its group's cfs_rq. With CFS
bandwidth control, that runqueue's PELT clock excludes time spent
throttled.
When a task marked for delayed dequeue wakes up, requeue_delayed_entity()
uses the root cfs_rq for EEVDF placement and also passes it to
update_load_avg(). If the group was previously throttled, the root clock
can advance the task's last_update_time past the group clock. The next
update on the group clock can then see a negative delta and reset the
timestamp without accumulating load.
Pass the task's cfs_rq to update_load_avg() on delayed wakeup.
Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2d9d3d686261..40b8f96b6b4a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8142,7 +8142,7 @@ requeue_delayed_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
cfs_rq->h_nr_queued++;
}
- update_load_avg(cfs_rq, se, 0);
+ update_load_avg(cfs_rq_of(se), se, 0);
clear_delayed(se);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] sched/fair: Use the task's cfs_rq for PELT on delayed wakeup
2026-12-04 12:20 [PATCH] sched/fair: Use the task's cfs_rq for PELT on delayed wakeup Chuyi Zhou
@ 2026-12-04 18:02 ` Kayra Cizmeci
2026-12-04 23:33 ` Peter Zijlstra
1 sibling, 0 replies; 3+ messages in thread
From: Kayra Cizmeci @ 2026-12-04 18:02 UTC (permalink / raw)
To: Chuyi Zhou
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, vschneid, kprateek.nayak, linux-kernel
Hi Chuyi,
On Fri, Dec 04, 2026 at 08:20:46PM +0800, Chuyi Zhou wrote:
> A task's PELT averages are tracked on its group's cfs_rq. With CFS
> bandwidth control, that runqueue's PELT clock excludes time spent
> throttled.
>
> When a task marked for delayed dequeue wakes up, requeue_delayed_entity()
> uses the root cfs_rq for EEVDF placement and also passes it to
> update_load_avg(). If the group was previously throttled, the root clock
> can advance the task's last_update_time past the group clock. The next
> update on the group clock can then see a negative delta and reset the
> timestamp without accumulating load.
>
> Pass the task's cfs_rq to update_load_avg() on delayed wakeup.
>
> Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 2d9d3d686261..40b8f96b6b4a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8142,7 +8142,7 @@ requeue_delayed_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
> cfs_rq->h_nr_queued++;
> }
>
> - update_load_avg(cfs_rq, se, 0);
> + update_load_avg(cfs_rq_of(se), se, 0);
> clear_delayed(se);
> }
>
> --
> 2.20.1
:-)
Makes sense.
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Thanks!
Kayra
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sched/fair: Use the task's cfs_rq for PELT on delayed wakeup
2026-12-04 12:20 [PATCH] sched/fair: Use the task's cfs_rq for PELT on delayed wakeup Chuyi Zhou
2026-12-04 18:02 ` Kayra Cizmeci
@ 2026-12-04 23:33 ` Peter Zijlstra
1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2026-12-04 23:33 UTC (permalink / raw)
To: Chuyi Zhou
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, vschneid, kprateek.nayak, linux-kernel
On Fri, Dec 04, 2026 at 08:20:46PM +0800, Chuyi Zhou wrote:
> A task's PELT averages are tracked on its group's cfs_rq. With CFS
> bandwidth control, that runqueue's PELT clock excludes time spent
> throttled.
>
> When a task marked for delayed dequeue wakes up, requeue_delayed_entity()
> uses the root cfs_rq for EEVDF placement and also passes it to
> update_load_avg(). If the group was previously throttled, the root clock
> can advance the task's last_update_time past the group clock. The next
> update on the group clock can then see a negative delta and reset the
> timestamp without accumulating load.
>
> Pass the task's cfs_rq to update_load_avg() on delayed wakeup.
>
> Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 2d9d3d686261..40b8f96b6b4a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8142,7 +8142,7 @@ requeue_delayed_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
> cfs_rq->h_nr_queued++;
> }
>
> - update_load_avg(cfs_rq, se, 0);
> + update_load_avg(cfs_rq_of(se), se, 0);
> clear_delayed(se);
> }
>
Right, so update_load_avg() is normally done by _entity functions on the
hierarchy part -- since we track load in the hierarchy.
However, this function *should* now be called requeue_delayed_task(),
and as you note the root cfs_rq and the task se are given.
So yes; this seems right. I'll apply the patch and munge in the rename
while there.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-04 23:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 12:20 [PATCH] sched/fair: Use the task's cfs_rq for PELT on delayed wakeup Chuyi Zhou
2026-12-04 18:02 ` Kayra Cizmeci
2026-12-04 23:33 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox