summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQais Yousef <qyousef@layalina.io>2023-09-17 00:29:54 +0100
committerIngo Molnar <mingo@kernel.org>2023-09-29 10:29:14 +0200
commit23c9519def98ee0fa97ea5871535e9b136f522fc (patch)
tree9ea31a14b48954e5a54bca208a054000ed8f2dec
parent6b00a40147653c8ea748e8f4396510f252763364 (diff)
downloadlinux-stable-23c9519def98ee0fa97ea5871535e9b136f522fc.tar.gz
linux-stable-23c9519def98ee0fa97ea5871535e9b136f522fc.tar.bz2
linux-stable-23c9519def98ee0fa97ea5871535e9b136f522fc.zip
sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0
find_energy_efficient_cpu() bails out early if effective util of the task is 0 as the delta at this point will be zero and there's nothing for EAS to do. When uclamp is being used, this could lead to wrong decisions when uclamp_max is set to 0. In this case the task is capped to performance point 0, but it is actually running and consuming energy and we can benefit from EAS energy calculations. Rework the condition so that it bails out when both util and uclamp_min are 0. We can do that without needing to use uclamp_task_util(); remove it. Fixes: d81304bc6193 ("sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit condition") Signed-off-by: Qais Yousef (Google) <qyousef@layalina.io> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org> Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20230916232955.2099394-3-qyousef@layalina.io
-rw-r--r--kernel/sched/fair.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4ce949bb0213..284b0abe7f9b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4558,22 +4558,6 @@ static inline unsigned long task_util_est(struct task_struct *p)
return max(task_util(p), _task_util_est(p));
}
-#ifdef CONFIG_UCLAMP_TASK
-static inline unsigned long uclamp_task_util(struct task_struct *p,
- unsigned long uclamp_min,
- unsigned long uclamp_max)
-{
- return clamp(task_util_est(p), uclamp_min, uclamp_max);
-}
-#else
-static inline unsigned long uclamp_task_util(struct task_struct *p,
- unsigned long uclamp_min,
- unsigned long uclamp_max)
-{
- return task_util_est(p);
-}
-#endif
-
static inline void util_est_enqueue(struct cfs_rq *cfs_rq,
struct task_struct *p)
{
@@ -7695,7 +7679,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
target = prev_cpu;
sync_entity_load_avg(&p->se);
- if (!uclamp_task_util(p, p_util_min, p_util_max))
+ if (!task_util_est(p) && p_util_min == 0)
goto unlock;
eenv_task_busy_time(&eenv, p, prev_cpu);