From: Xuewen Yan <xuewen.yan@unisoc.com>
To: <vincent.guittot@linaro.org>, <dietmar.eggemann@arm.com>,
<mingo@redhat.com>, <peterz@infradead.org>,
<juri.lelli@redhat.com>, <qyousef@layalina.io>
Cc: <rostedt@goodmis.org>, <bsegall@google.com>, <mgorman@suse.de>,
<bristot@redhat.com>, <vschneid@redhat.com>,
<christian.loehle@arm.com>, <vincent.donnefort@arm.com>,
<ke.wang@unisoc.com>, <di.shen@unisoc.com>,
<xuewen.yan94@gmail.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH V2 1/2] sched/fair: Prevent cpu_busy_time from exceeding actual_cpu_capacity
Date: Mon, 24 Jun 2024 16:20:10 +0800 [thread overview]
Message-ID: <20240624082011.4990-2-xuewen.yan@unisoc.com> (raw)
In-Reply-To: <20240624082011.4990-1-xuewen.yan@unisoc.com>
Commit 3e8c6c9aac42 ("sched/fair: Remove task_util from effective utilization in feec()")
changed the PD's util from per-CPU to per-PD capping. But 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>
Tested-by: Christian Loehle <christian.loehle@arm.com>
---
V2:
- change commit message.
- remove the eenv->pd_cap capping in eenv_pd_busy_time(). (Dietmar)
- add Tested-by.
---
kernel/sched/fair.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8a5b1ae0aa55..5ca6396ef0b7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7864,16 +7864,17 @@ static inline void eenv_pd_busy_time(struct energy_env *eenv,
struct cpumask *pd_cpus,
struct task_struct *p)
{
- unsigned long busy_time = 0;
int cpu;
+ eenv->pd_busy_time = 0;
+
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);
+ eenv->pd_busy_time += util;
}
-
- eenv->pd_busy_time = min(eenv->pd_cap, busy_time);
}
/*
--
2.25.1
next prev parent reply other threads:[~2024-06-24 8:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 8:20 [PATCH V2 0/2] sched/fair: Some improvements to feec() Xuewen Yan
2024-06-24 8:20 ` Xuewen Yan [this message]
2024-06-25 13:04 ` [PATCH V2 1/2] sched/fair: Prevent cpu_busy_time from exceeding actual_cpu_capacity Vincent Guittot
2024-06-27 2:02 ` Xuewen Yan
2024-06-27 16:15 ` Vincent Guittot
2024-06-28 1:39 ` Qais Yousef
2024-07-01 12:00 ` Xuewen Yan
2024-07-04 17:01 ` Pierre Gondois
2024-07-05 0:10 ` Qais Yousef
2024-06-24 8:20 ` [PATCH V2 2/2] sched/fair: Use actual_cpu_capacity everywhere in util_fits_cpu() Xuewen Yan
2024-06-25 8:46 ` Vincent Guittot
2024-06-28 1:28 ` Qais Yousef
2024-07-01 12:13 ` Xuewen Yan
2024-07-03 11:46 ` Qais Yousef
2024-07-02 13:25 ` Vincent Guittot
2024-07-03 11:54 ` Qais Yousef
2024-07-03 14:54 ` Vincent Guittot
2024-07-04 23:56 ` Qais Yousef
2024-07-05 6:25 ` Dietmar Eggemann
2024-07-16 11:56 ` Xuewen Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240624082011.4990-2-xuewen.yan@unisoc.com \
--to=xuewen.yan@unisoc.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=christian.loehle@arm.com \
--cc=di.shen@unisoc.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=qyousef@layalina.io \
--cc=rostedt@goodmis.org \
--cc=vincent.donnefort@arm.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=xuewen.yan94@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®