From: Christian Loehle <christian.loehle@arm.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
rafael@kernel.org
Cc: vincent.guittot@linaro.org, qyousef@layalina.io,
peterz@infradead.org, daniel.lezcano@linaro.org,
ulf.hansson@linaro.org, anna-maria@linutronix.de,
kajetan.puchalski@arm.com, lukasz.luba@arm.com
Subject: Re: [PATCHv2 2/3] cpuidle: teo: Remove recent intercepts metric
Date: Wed, 26 Jun 2024 13:41:13 +0100 [thread overview]
Message-ID: <16281948-047a-4b0a-a083-8abe2482f2f5@arm.com> (raw)
In-Reply-To: <06231a07-c470-4156-bada-41b346b280cb@arm.com>
On 6/26/24 11:44, Dietmar Eggemann wrote:
> On 11/06/2024 13:24, Christian Loehle wrote:
>> The logic for recent intercepts didn't work, there is an underflow
>> of the 'recent' value that can be observed during boot already, which
>> teo usually doesn't recover from, making the entire logic pointless.
>> Furthermore the recent intercepts also were never reset, thus not
>> actually being very 'recent'.
>>
>> Having underflowed 'recent' values lead to teo always acting as if
>> we were in a scenario were expected sleep length based on timers is
>> too high and it therefore unnecessarily selecting shallower states.
>>
>> Experiments show that the remaining 'intercept' logic is enough to
>> quickly react to scenarios in which teo cannot rely on the timer
>> expected sleep length.
>>
>> See also here:
>> https://lore.kernel.org/lkml/0ce2d536-1125-4df8-9a5b-0d5e389cd8af@arm.com/
>
> So the fixes proposed in teo_update() there:
>
> (1) add '&& cpu_data->state_bins[cpu_data->recent_idx[i]].recent' to the
> if condition to decrement 'cpu_data->state_bins[].recent' or
That fixes the underflow for sure, but doesn't make much sense either.
You still have a value called 'recent' that isn't actually reset regularly.
So an intercept-heavy workload can still affect the system
minutes/hours/days later. There is no reset nor EMA, so if anything, the
regular intercept counters would be the 'recent' one.
See also below.
>
> (2) Set 'cpu_data->state_bins[].recent' = 0 instead of decrement
That also 'works' in the sense that it doesn't contain blatantly obvious
values then. It is basically a 1bit information about recent intercepts,
I didn't see much practical use for that, given that the EMA of intercepts
(See patch 3), is quite aggressive (i.e. 'recent').
If an additional intercept that is more 'recent' (and one that is less
'recent') was ever needed I don't know and would defer to Rafael here.
I don't see the need for one after this series is applied, though.
The two suggestions above are 'fixes', this v2 2/3 is now more of a
revert you could say. (I didn't tag it as such explicitly because the
commit did more than just add the 'recent' tracking, so it's not a revert.)
>
> didn't work?
>
>> Fixes: 77577558f25d ("cpuidle: teo: Rework most recent idle duration values treatment")
>> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
>> ---
>> drivers/cpuidle/governors/teo.c | 73 ++++++---------------------------
>> 1 file changed, 12 insertions(+), 61 deletions(-)
>>
>> diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
>> index d8554c20cf10..cc7df59f488d 100644
>> --- a/drivers/cpuidle/governors/teo.c
>> +++ b/drivers/cpuidle/governors/teo.c
>> @@ -59,10 +59,6 @@
>> * shallower than the one whose bin is fallen into by the sleep length (these
>> * situations are referred to as "intercepts" below).
>> *
>> - * In addition to the metrics described above, the governor counts recent
>> - * intercepts (that is, intercepts that have occurred during the last
>> - * %NR_RECENT invocations of it for the given CPU) for each bin.
>> - *
>> * In order to select an idle state for a CPU, the governor takes the following
>> * steps (modulo the possible latency constraint that must be taken into account
>> * too):
>> @@ -81,20 +77,15 @@
>
> 66 * 1. Find the deepest CPU idle state whose target residency does not exceed
> 67 * the current sleep length (the candidate idle state) and compute 3 sums as
>
> s/3/2 ?
Thanks, good catch!
>
> [...]
>
>> @@ -320,8 +288,6 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>> unsigned int tick_intercept_sum = 0;
>> unsigned int idx_intercept_sum = 0;
>> unsigned int intercept_sum = 0;
>> - unsigned int idx_recent_sum = 0;
>> - unsigned int recent_sum = 0;
>> unsigned int idx_hit_sum = 0;
>> unsigned int hit_sum = 0;
>> int constraint_idx = 0;
>
> Looks like 'bool alt_intercepts, alt_recent' have to go here already and
> not in 3/3.
Correct, will pick that up.
Thank you for reviewing!
>
> [...]
next prev parent reply other threads:[~2024-06-26 12:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 11:24 [PATCHv2 0/3] cpuidle: teo: Fixing utilization and intercept logic Christian Loehle
2024-06-11 11:24 ` [PATCHv2 1/3] Revert: "cpuidle: teo: Introduce util-awareness" Christian Loehle
2024-06-11 13:37 ` Vincent Guittot
2024-06-19 17:49 ` Qais Yousef
2024-06-21 13:22 ` [PATCHv3 " Christian Loehle
2024-06-11 11:24 ` [PATCHv2 2/3] cpuidle: teo: Remove recent intercepts metric Christian Loehle
2024-06-26 10:44 ` Dietmar Eggemann
2024-06-26 12:41 ` Christian Loehle [this message]
2024-06-11 11:24 ` [PATCHv2 3/3] cpuidle: teo: Don't count non-existent intercepts Christian Loehle
2024-06-26 13:09 ` Dietmar Eggemann
2024-06-28 9:33 ` Christian Loehle
2024-06-17 0:20 ` [PATCHv2 0/3] cpuidle: teo: Fixing utilization and intercept logic Doug Smythies
2024-06-18 11:17 ` Christian Loehle
2024-06-18 17:24 ` Doug Smythies
2024-06-20 11:19 ` Christian Loehle
2024-06-25 16:35 ` Doug Smythies
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=16281948-047a-4b0a-a083-8abe2482f2f5@arm.com \
--to=christian.loehle@arm.com \
--cc=anna-maria@linutronix.de \
--cc=daniel.lezcano@linaro.org \
--cc=dietmar.eggemann@arm.com \
--cc=kajetan.puchalski@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=peterz@infradead.org \
--cc=qyousef@layalina.io \
--cc=rafael@kernel.org \
--cc=ulf.hansson@linaro.org \
--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®