From: Hongyan Xia <hongyan.xia2@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Juri Lelli <juri.lelli@redhat.com>,
Qais Yousef <qyousef@layalina.io>,
Morten Rasmussen <morten.rasmussen@arm.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Christian Loehle <christian.loehle@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/6] sched/uclamp: Track uclamped util_avg in sched_avg
Date: Tue, 5 Dec 2023 14:24:23 +0000 [thread overview]
Message-ID: <7cad55e3-3a61-498a-9364-7a2d69a20757@arm.com> (raw)
In-Reply-To: <CAKfTPtBahrEDyaWqyyivmo=9Jagq4OBDv1bQm4AcBP2Xq_EpRw@mail.gmail.com>
On 04/12/2023 16:07, Vincent Guittot wrote:
> On Wed, 4 Oct 2023 at 11:05, Hongyan Xia <Hongyan.Xia2@arm.com> wrote:
>>
>> From: Hongyan Xia <hongyan.xia2@arm.com>
>>
>> Track a uclamped version of util_avg in sched_avg, which clamps util_avg
>> within [uclamp[UCLAMP_MIN], uclamp[UCLAMP_MAX]] every time util_avg is
>> updated. At the CFS rq level, cfs_rq->avg.util_avg_uclamp must always be
>> the sum of all util_avg_uclamp of entities on this cfs_rq. So, each
>> time the util_avg_uclamp of an entity gets updated, we also track the
>> delta and update the cfs_rq.
>
> No please don't do that. Don't start to mix several different signals
> in one. Typically uclamp_min doen't say you want to use at least this
> amount of cpu capacity.
But I'd say with uclamp, PELT is already broken and is a mixed signal
anyway. When uclamp is used, a util_avg value X doesn't mean X, it means
X under some rq uclamp, and the worst part is that the rq uclamp may or
may not have anything to do with this task's uclamp.
Pretending X is a true PELT value now (and not a mixed value) is why we
have so many problems today. For example in the frequency spike problem,
if a task A has no idle time under uclamp_max, its PELT does not reflect
reality. The moment another task B comes in and uncap the rq uclamp_max,
the current scheduler code thinks the 1024 of A means a real 1024, which
is wrong and is exactly why we see a spike when B joins. It's also why
we need to special case 0 spare capacity with recent patches, because rq
util_avg has lost its original PELT meaning under uclamp.
Because X is not the true PELT, we always have to do something to bring
it back into reality. What the current max aggregation code does is to
introduce corner cases, like treating 0 spare capacity as potential
opportunity to queue more tasks (which creates further problems in my
tests), and maybe introducing uclamp load balancing special cases in the
future, or introducing uclamp filtering to delay the effect of wrong
PELT values.
What this series does is not much different. We keep the somewhat wrong
value X, but we also remember under what uclamp values did we get that X
to bring things back into reality, which means now we have [X,
uclamp_min when X happens, uclamp_max when X happens]. To save space,
this becomes [X, clamped X], which is what this series does. The
original PELT value X is kept, but we use the clamped X in several
places to improve our decisions.
>
> With tasks with a util_avg of 10 but a uclamp min of 1024 what does it
> mean when you start to sum this value ?
Like I replied in another comment, assuming a uclamp_min of 1024 is a
hint to run the task on the big CPUs, I don't think it's right to
directly use uclamp as a CPU placement indicator. A uclamp value may
come from ADFP from userspace. An ADPF uclamp_min value of little CPU
capacity + 1 certainly doesn't mean a game on purpose wants to avoid the
little core. It simply means it wants at least this much performance,
and whether this results in placing the game thread on a big CPU is
purely the job of EAS (or CAS, etc.). We want to use little CPU + 1 as
uclamp_min because we know the SoC and the little CPU is bad, but uclamp
should be generic and should not rely on knowing the SoC.
Basically, under sum aggregation one would not use a uclamp_min value of
1024 to place a small task on a big core. A uclamp_min of 1024 under sum
aggregation has the meaning in ADPF, which is a hint to try to run me as
fast as possible.
>
>
>> [...]
next prev parent reply other threads:[~2023-12-05 14:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 9:04 [RFC PATCH 0/6] sched: uclamp sum aggregation Hongyan Xia
2023-10-04 9:04 ` [RFC PATCH 1/6] sched/uclamp: Track uclamped util_avg in sched_avg Hongyan Xia
2023-10-31 15:52 ` Dietmar Eggemann
2023-11-09 16:05 ` Hongyan Xia
2023-11-14 12:59 ` Dietmar Eggemann
2023-12-04 16:07 ` Vincent Guittot
2023-12-05 14:24 ` Hongyan Xia [this message]
2023-12-05 16:22 ` Vincent Guittot
2023-10-04 9:04 ` [RFC PATCH 2/6] sched/uclamp: Simulate PELT decay in util_avg_uclamp Hongyan Xia
2023-11-01 16:06 ` Dietmar Eggemann
2023-11-09 16:50 ` Hongyan Xia
2023-12-04 16:07 ` Vincent Guittot
2023-12-05 14:47 ` Hongyan Xia
2023-10-04 9:04 ` [RFC PATCH 3/6] sched/fair: Use CFS util_avg_uclamp for utilization and frequency Hongyan Xia
2023-11-01 22:34 ` Dietmar Eggemann
2023-10-04 9:04 ` [RFC PATCH 4/6] sched/fair: Rewrite util_fits_cpu() Hongyan Xia
2023-11-02 17:37 ` Dietmar Eggemann
2023-10-04 9:04 ` [RFC PATCH 5/6] sched/uclamp: Remove all uclamp bucket logic Hongyan Xia
2023-11-03 13:50 ` Dietmar Eggemann
2023-11-03 14:01 ` Hongyan Xia
2023-10-04 9:04 ` [RFC PATCH 6/6] sched/uclamp: Simplify uclamp_eff_value() Hongyan Xia
2023-11-03 14:50 ` Dietmar Eggemann
2023-10-30 18:46 ` [RFC PATCH 0/6] sched: uclamp sum aggregation Dietmar Eggemann
2023-11-03 11:19 ` Hongyan Xia
2023-11-13 9:26 ` Dietmar Eggemann
2023-12-03 0:25 ` Qais Yousef
2023-12-04 1:48 ` Hongyan Xia
2023-12-04 16:12 ` Vincent Guittot
2023-12-05 15:18 ` Hongyan Xia
2023-12-05 16:26 ` Vincent Guittot
2023-12-05 17:23 ` Hongyan Xia
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=7cad55e3-3a61-498a-9364-7a2d69a20757@arm.com \
--to=hongyan.xia2@arm.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=mingo@redhat.com \
--cc=morten.rasmussen@arm.com \
--cc=peterz@infradead.org \
--cc=qyousef@layalina.io \
--cc=vincent.guittot@linaro.org \
/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®