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

From: Dietmar Eggemann
Date: Mon Jul 29 2024 - 03:56:57 EST


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?

[...]

> @@ -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'.

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

[...]

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