The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Prevent cpu_busy_time from exceeding actual_cpu_capacity
@ 2024-06-06  7:06 Xuewen Yan
  2024-06-07  7:19 ` Dietmar Eggemann
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Xuewen Yan @ 2024-06-06  7:06 UTC (permalink / raw)
  To: vincent.guittot, mingo, peterz, juri.lelli, dietmar.eggemann
  Cc: rostedt, bsegall, mgorman, bristot, vschneid, vincent.donnefort,
	qyousef, ke.wang, xuewen.yan94, linux-kernel

Because the effective_cpu_util() would return a util which
maybe bigger than the actual_cpu_capacity, this could cause
the pd_busy_time calculation errors.
So clamp the cpu_busy_time with the eenv->cpu_cap, which is
the actual_cpu_capacity.

Fixes: 3e8c6c9aac42 ("sched/fair: Remove task_util from effective utilization in feec()")
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
 kernel/sched/fair.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8a5b1ae0aa55..8939d725023a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7870,7 +7870,9 @@ static inline void eenv_pd_busy_time(struct energy_env *eenv,
 	for_each_cpu(cpu, pd_cpus) {
 		unsigned long util = cpu_util(cpu, p, -1, 0);
 
-		busy_time += effective_cpu_util(cpu, util, NULL, NULL);
+		util = effective_cpu_util(cpu, util, NULL, NULL);
+		util = min(eenv->cpu_cap, util);
+		busy_time += util;
 	}
 
 	eenv->pd_busy_time = min(eenv->pd_cap, busy_time);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2024-06-24  2:36 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06  7:06 [PATCH] sched/fair: Prevent cpu_busy_time from exceeding actual_cpu_capacity Xuewen Yan
2024-06-07  7:19 ` Dietmar Eggemann
2024-06-07  8:20   ` Xuewen Yan
2024-06-07 10:30     ` Dietmar Eggemann
2024-06-07 10:37       ` Xuewen Yan
2024-06-21 10:22         ` Dietmar Eggemann
2024-06-24  2:27           ` Xuewen Yan
2024-06-09 22:55 ` Qais Yousef
2024-06-12  8:11   ` Xuewen Yan
2024-06-16 22:20     ` Qais Yousef
2024-06-17  7:27       ` Xuewen Yan
2024-06-17 11:03         ` Qais Yousef
2024-06-18 14:58           ` Qais Yousef
2024-06-19  2:46             ` Xuewen Yan
2024-06-19 18:03               ` Qais Yousef
2024-06-20  3:08                 ` Xuewen Yan
2024-06-21 10:40               ` Dietmar Eggemann
2024-06-21 13:00                 ` Vincent Guittot
2024-06-24  2:35                   ` Xuewen Yan
2024-06-18 15:20           ` Vincent Guittot
2024-06-18 15:26             ` Qais Yousef
2024-06-17  9:07       ` Vincent Guittot
2024-06-17 10:53         ` Qais Yousef
2024-06-18 15:23           ` Vincent Guittot
2024-06-18 15:39             ` Qais Yousef
2024-06-18 21:05               ` Vincent Guittot
2024-06-19 18:01                 ` Qais Yousef
2024-06-19  3:05               ` Xuewen Yan
2024-06-19 18:10                 ` Qais Yousef
2024-06-20  7:45                   ` Vincent Guittot
2024-06-20 11:37                     ` Qais Yousef
2024-06-21  8:22                       ` Dietmar Eggemann
2024-06-11  9:08 ` Christian Loehle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox