From: Hongyan Xia <hongyan.xia2@arm.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Juri Lelli <juri.lelli@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Christian Loehle <christian.loehle@arm.com>,
Pierre Gondois <pierre.gondois@arm.com>,
linux-kernel@vger.kernel.org, Hongyan Xia <Hongyan.Xia2@arm.com>
Subject: [PATCH v2 1/8] Revert "sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0"
Date: Tue, 4 Mar 2025 14:23:08 +0000 [thread overview]
Message-ID: <4d7dc8f07bede735d307969ca58ed145ff2254eb.1741091349.git.hongyan.xia2@arm.com> (raw)
In-Reply-To: <cover.1741091349.git.hongyan.xia2@arm.com>
From: Hongyan Xia <Hongyan.Xia2@arm.com>
That commit creates further problems because 0 spare capacity can be
either a real indication that the CPU is maxed out, or the CPU is
UCLAMP_MAX throttled, but we end up giving all of them a chance which
can results in bogus energy calculations. It also tends to schedule
tasks on the same CPU and requires load balancing patches. Sum
aggregation solves these problems and this patch is not needed.
This reverts commit 6b00a40147653c8ea748e8f4396510f252763364.
Signed-off-by: Hongyan Xia <hongyan.xia2@arm.com>
---
kernel/sched/fair.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 857808da23d8..71fc86eafbd9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8417,10 +8417,11 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
for (; pd; pd = pd->next) {
unsigned long util_min = p_util_min, util_max = p_util_max;
unsigned long cpu_cap, cpu_actual_cap, util;
- long prev_spare_cap = -1, max_spare_cap = -1;
+ unsigned long cur_delta, max_spare_cap = 0;
unsigned long rq_util_min, rq_util_max;
- unsigned long cur_delta, base_energy;
+ unsigned long prev_spare_cap = 0;
int max_spare_cap_cpu = -1;
+ unsigned long base_energy;
int fits, max_fits = -1;
cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask);
@@ -8482,7 +8483,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
prev_spare_cap = cpu_cap;
prev_fits = fits;
} else if ((fits > max_fits) ||
- ((fits == max_fits) && ((long)cpu_cap > max_spare_cap))) {
+ ((fits == max_fits) && (cpu_cap > max_spare_cap))) {
/*
* Find the CPU with the maximum spare capacity
* among the remaining CPUs in the performance
@@ -8494,7 +8495,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
}
}
- if (max_spare_cap_cpu < 0 && prev_spare_cap < 0)
+ if (max_spare_cap_cpu < 0 && prev_spare_cap == 0)
continue;
eenv_pd_busy_time(&eenv, cpus, p);
@@ -8502,7 +8503,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
base_energy = compute_energy(&eenv, pd, cpus, p, -1);
/* Evaluate the energy impact of using prev_cpu. */
- if (prev_spare_cap > -1) {
+ if (prev_spare_cap > 0) {
prev_delta = compute_energy(&eenv, pd, cpus, p,
prev_cpu);
/* CPU utilization has changed */
--
2.34.1
next prev parent reply other threads:[~2025-03-04 14:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 14:23 [PATCH v2 0/8] uclamp sum aggregation Hongyan Xia
2025-03-04 14:23 ` Hongyan Xia [this message]
2025-03-04 14:23 ` [PATCH v2 2/8] sched/uclamp: Track a new util_avg_bias signal Hongyan Xia
2025-03-04 14:23 ` [PATCH v2 3/8] sched/uclamp: Add util_est_uclamp Hongyan Xia
2025-03-04 14:23 ` [PATCH v2 4/8] sched/fair: Use util biases for utilization and frequency Hongyan Xia
2025-03-04 14:23 ` [PATCH v2 5/8] sched/uclamp: Remove all uclamp bucket logic Hongyan Xia
2025-03-04 14:23 ` [PATCH v2 6/8] sched/uclamp: Simplify uclamp_eff_value() Hongyan Xia
2025-03-04 14:23 ` [PATCH v2 7/8] sched/uclamp: Propagate negative bias Hongyan Xia
2025-03-04 14:23 ` [PATCH v2 8/8] sched/uclamp: Solve under-utilization problem Hongyan Xia
2025-03-06 11:12 ` [PATCH v2 0/8] uclamp sum aggregation Xuewen Yan
2025-03-06 11:32 ` Hongyan Xia
2025-03-06 11:38 ` Xuewen Yan
2025-03-10 11:34 ` Dietmar Eggemann
2025-03-10 12:54 ` Hongyan Xia
2025-03-10 15:37 ` Dietmar Eggemann
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=4d7dc8f07bede735d307969ca58ed145ff2254eb.1741091349.git.hongyan.xia2@arm.com \
--to=hongyan.xia2@arm.com \
--cc=bsegall@google.com \
--cc=christian.loehle@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=morten.rasmussen@arm.com \
--cc=peterz@infradead.org \
--cc=pierre.gondois@arm.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®