Re: [PATCH 7/7 v2] sched/fair: Update overutilized detection

From: Pierre Gondois
Date: Fri Jan 17 2025 - 05:28:02 EST


Hello Vincent,

On 12/17/24 17:07, Vincent Guittot wrote:
Checking uclamp_min is useless and counterproductive for overutilized state
as misfit can now happen without being in overutilized state

Before this patch a task was misfit if:
!task_fits_cpu(p, cpu)
This is, if either:
- task_util > 80% * CPU_capacity
- task_UCLAMP_MIN > get_actual_cpu_capacity(cpu)

A CPU was OU if:
!util_fits_cpu(cpu_util_cfs(cpu), rq_util_min, rq_util_max, cpu)
This is:
- CPU_util > 80% * CPU_capacity

This should be the same after this patch. Just to be sure I understand correctly,
this patch has no functional change and is independent from this serie right ?


Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
---
kernel/sched/fair.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9bddb094ee21..9eb4c4946ddc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6870,16 +6870,15 @@ static inline void hrtick_update(struct rq *rq)
#ifdef CONFIG_SMP
static inline bool cpu_overutilized(int cpu)
{
- unsigned long rq_util_min, rq_util_max;
+ unsigned long rq_util_max;
if (!sched_energy_enabled())
return false;
- rq_util_min = uclamp_rq_get(cpu_rq(cpu), UCLAMP_MIN);
rq_util_max = uclamp_rq_get(cpu_rq(cpu), UCLAMP_MAX);
/* Return true only if the utilization doesn't fit CPU's capacity */
- return !util_fits_cpu(cpu_util_cfs(cpu), rq_util_min, rq_util_max, cpu);
+ return !util_fits_cpu(cpu_util_cfs(cpu), 0, rq_util_max, cpu);
}
/*