[PATCH] sched/fair: Update overutilized detection

Vincent Guittot posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
kernel/sched/fair.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] sched/fair: Update overutilized detection
Posted by Vincent Guittot 1 month, 2 weeks ago
Checking uclamp_min is useless and counterproductive for overutilized state
as misfit can now happen without being in overutilized state.

Since commit e5ed0550c04c ("sched/fair: unlink misfit task from cpu overutilized")
util_fits_cpu returns -1 when uclamp_min is above capacity which is not
considered as cpu overutilized.

Remove the useless rq_util_min parameter.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Qais Yousef <qyousef@layalina.io>
---
 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 c16b5fd71b2d..fdc4303ca83a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6776,16 +6776,15 @@ static inline void hrtick_update(struct rq *rq)
 
 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);
 }
 
 /*
-- 
2.43.0
Re: [PATCH] sched/fair: Update overutilized detection
Posted by Christian Loehle 1 month, 2 weeks ago
On 2/13/26 10:17, Vincent Guittot wrote:
> Checking uclamp_min is useless and counterproductive for overutilized state
> as misfit can now happen without being in overutilized state.

I'd remove the "now" since it's been a while...
Also the title could be more specific and include "uclamp_min"

> 
> Since commit e5ed0550c04c ("sched/fair: unlink misfit task from cpu overutilized")
> util_fits_cpu returns -1 when uclamp_min is above capacity which is not
> considered as cpu overutilized.
> 
> Remove the useless rq_util_min parameter.
> 
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> Reviewed-by: Qais Yousef <qyousef@layalina.io>

Reviewed-by: Christian Loehle <christian.loehle@arm.com>

> ---
>  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 c16b5fd71b2d..fdc4303ca83a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6776,16 +6776,15 @@ static inline void hrtick_update(struct rq *rq)
>  
>  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);
>  }
>  
>  /*
[tip: sched/core] sched/fair: Update overutilized detection
Posted by tip-bot2 for Vincent Guittot 1 month, 1 week ago
The following commit has been merged into the sched/core branch of tip:

Commit-ID:     9264758066061e660c86e48cff1bac4a58a7324a
Gitweb:        https://git.kernel.org/tip/9264758066061e660c86e48cff1bac4a58a7324a
Author:        Vincent Guittot <vincent.guittot@linaro.org>
AuthorDate:    Fri, 13 Feb 2026 11:17:51 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 23 Feb 2026 18:04:11 +01:00

sched/fair: Update overutilized detection

Checking uclamp_min is useless and counterproductive for overutilized state
as misfit can now happen without being in overutilized state.

Since commit e5ed0550c04c ("sched/fair: unlink misfit task from cpu overutilized")
util_fits_cpu returns -1 when uclamp_min is above capacity which is not
considered as cpu overutilized.

Remove the useless rq_util_min parameter.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Qais Yousef <qyousef@layalina.io>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/20260213101751.3121899-1-vincent.guittot@linaro.org
---
 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 23315c2..b8b052b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7018,16 +7018,15 @@ static inline void hrtick_update(struct rq *rq)
 
 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);
 }
 
 /*