Re: [PATCH v2 1/2] sched/schedutil: rework performance estimation

From: Dietmar Eggemann
Date: Thu Nov 02 2023 - 08:16:57 EST


On 26/10/2023 19:09, Vincent Guittot wrote:

[...]

> @@ -153,14 +152,38 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
> return cpufreq_driver_resolve_freq(policy, freq);
> }
>
> +unsigned long sugov_effective_cpu_perf(int cpu, unsigned long actual,
> + unsigned long min,
> + unsigned long max)
> +{
> + unsigned long target;
> + struct rq *rq = cpu_rq(cpu);
> +
> + if (rt_rq_is_runnable(&rq->rt))
> + return max;
> +
> + /* Provide at least enough capacity for DL + IRQ */
> + target = min;
> +
> + actual = map_util_perf(actual);
> + /* Actually we don't need to target the max performance */
> + if (actual < max)
> + max = actual;
> +
> + /*
> + * Ensure at least minimum performance while providing more compute
> + * capacity when possible.
> + */
> + return max(target, max);

The superfluous `unsigned long target` is still there?

return max(min, max) is much cleaer.

[...]