Re: [PATCH 1/4] sched/fair: Be less aggressive in calling cpufreq_update_util()

From: Dietmar Eggemann
Date: Tue Dec 12 2023 - 05:46:47 EST


On 08/12/2023 02:52, Qais Yousef wrote:
> Due to the way code is structured, it makes a lot of sense to trigger
> cpufreq_update_util() from update_load_avg(). But this is too aggressive
> as in most cases we are iterating through entities in a loop to
> update_load_avg() in the hierarchy. So we end up sending too many
> request in an loop as we're updating the hierarchy.

But update_load_avg() calls cfs_rq_util_change() which only issues a
cpufreq_update_util() call for the root cfs_rq?

So the 'iterating through entities' should be for a task in a non-root
taskgroup which the condition (1) takes care of.

cfs_rq_util_change()

...
if (&rq->cfs == cfs_rq) (1)

cpufreq_update_util()

[...]