Re: [PATCH v3 04/10] sched/fair: Remove magic hardcoded margin in fits_capacity()
From: zhidao su (Xiaomi)
Date: Thu Dec 03 2026 - 03:28:51 EST
Hi Qais,
On Thu, Nov 26, 2026 at 05:14:23AM +0000, Qais Yousef wrote:
> To calculate this threshold, we use the new approximate_util_avg()
> function to find out the threshold, based on arch_scale_cpu_capacity()
> the task will be misfit if it continues to run for a TICK_USEC which is
> our worst case scenario for when misfit migration will kick in.
Using arch_scale_cpu_capacity() for the threshold is clear. What I don't
follow is what happens to capacity pressure.
> - unsigned long capacity = capacity_of(cpu);
> ...
> - fits = fits_capacity(util, capacity);
> + fits = fits_capacity(util, cpu);
capacity_of() took thermal and rt/dl/irq pressure out of the real-util
comparison. Now a throttled CPU and an idle one report the same
threshold, and a task whose util sits between the two fits where it did
not before.
The comment below still says the opposite:
> /*
> * We must use arch_scale_cpu_capacity() for comparing against uclamp_min and
> * uclamp_max. We only care about capacity pressure (by using
> * capacity_of()) for comparing against the real util.
Pressure is now honoured only on the uclamp_min path, through
get_actual_cpu_capacity().
Was dropping it from the real-util path intentional? If so, the comment
needs to change in this patch too.
Thanks,
Zhidao