Re: [PATCH v3] sched/fair: Sync se's load_avg with cfs_rq in reweight_task

From: Chuyi Zhou
Date: Mon Jul 29 2024 - 04:20:54 EST


Hello,

在 2024/7/29 15:56, Dietmar Eggemann 写道:
On 23/07/2024 13:42, Chuyi Zhou wrote:
In reweight_task(), there are two situations:

1. The task was on_rq, then the task's load_avg is accurate because we
synchronized it with cfs_rq through update_load_avg() in dequeue_task().

Just asking: That's the dequeue_task() in __sched_setscheduler() or
set_user_nice()? Maybe this is worth mentioning here?

OK.


[...]

@@ -3795,7 +3816,9 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
if (!curr)
__dequeue_entity(cfs_rq, se);
update_load_sub(&cfs_rq->load, se->load.weight);
- }
+ } else if (entity_is_task(se))
+ sync_entity_load_avg(se);
+

IMHO, the 'if else' path needs braces. See
Documentation/process/coding-style.rst '3) Placing Braces and Spaces'.

Thanks, will fix it in next version.


dequeue_load_avg(cfs_rq, se);
if (se->on_rq) {

[...]

Reviewed-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>