mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Qais Yousef <qyousef@layalina.io>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	rafael@kernel.org, vincent.guittot@linaro.org,
	peterz@infradead.org, daniel.lezcano@linaro.org,
	anna-maria@linutronix.de, kajetan.puchalski@arm.com,
	lukasz.luba@arm.com, dietmar.eggemann@arm.com
Subject: Re: [PATCH 1/6] cpuidle: teo: Increase util-threshold
Date: Mon, 10 Jun 2024 10:11:01 +0100	[thread overview]
Message-ID: <569b7923-d7ba-49a9-a88d-906f44903d20@arm.com> (raw)
In-Reply-To: <20240609224701.pc6om2o5ep6btywe@airbuntu>

On 6/9/24 23:47, Qais Yousef wrote:
> On 06/06/24 10:00, Christian Loehle wrote:
>> Increase the util-threshold by a lot as it was low enough for some
>> minor load to always be active, especially on smaller CPUs.
>>
>> For small cap CPUs (Pixel6) the util threshold is as low as 1.
>> For CPUs of capacity <64 it is 0. So ensure it is at a minimum, too.
>>
>> Fixes: 9ce0f7c4bc64 ("cpuidle: teo: Introduce util-awareness")
>> Reported-by: Qais Yousef <qyousef@layalina.io>
>> Reported-by: Vincent Guittot <vincent.guittot@linaro.org>
>> Suggested-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
>> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
>> ---
>>  drivers/cpuidle/governors/teo.c | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
>> index 7244f71c59c5..45f43e2ee02d 100644
>> --- a/drivers/cpuidle/governors/teo.c
>> +++ b/drivers/cpuidle/governors/teo.c
>> @@ -146,13 +146,11 @@
>>   * The number of bits to shift the CPU's capacity by in order to determine
>>   * the utilized threshold.
>>   *
>> - * 6 was chosen based on testing as the number that achieved the best balance
>> - * of power and performance on average.
>> - *
>>   * The resulting threshold is high enough to not be triggered by background
>> - * noise and low enough to react quickly when activity starts to ramp up.
>> + * noise.
>>   */
>> -#define UTIL_THRESHOLD_SHIFT 6
>> +#define UTIL_THRESHOLD_SHIFT 2
>> +#define UTIL_THRESHOLD_MIN 50
>>  
>>  /*
>>   * The PULSE value is added to metrics when they grow and the DECAY_SHIFT value
>> @@ -671,7 +669,8 @@ static int teo_enable_device(struct cpuidle_driver *drv,
>>  	int i;
>>  
>>  	memset(cpu_data, 0, sizeof(*cpu_data));
>> -	cpu_data->util_threshold = max_capacity >> UTIL_THRESHOLD_SHIFT;
>> +	cpu_data->util_threshold = max(UTIL_THRESHOLD_MIN,
>> +				max_capacity >> UTIL_THRESHOLD_SHIFT);
> 
> Thanks for trying to fix this. But I am afraid this is not a solution. There's
> no magic number that can truly work here - we tried. As I tried to explain
> before, a higher util value doesn't mean long idle time is unlikely. And
> blocked load can cause problems where a decay can take too long.
> 
> We are following up with the suggestions I have thrown back then and we'll
> share results if anything actually works.

Namely watching increase / decrease of utilization?
I think you would have to watch at least a couple of values before entering such
a logic and at that point the intercepts logic will handle it anyway.
Furthermore IMO we should be wary about introducing any state in teo that persists
across calls if not absolutely necessary (like intercept-detection) as it really
makes teo much less predictable.

> 
> For now, I think a revert is more appropriate. There was some perf benefit, but
> the power regressions were bad and there's no threshold value that actually
> works. The thresholding concept itself is incorrect and flawed - it seemed the
> correct thing back then, yes. But in a hindsight now it doesn't work.

Unfortunate :/
OK. I'll do some more testing with that, too. From what I can see a revert wouldn't
have terrible fallout with the series altogether, so I might just change this for
v2 and drop 2/6.

Kind Regards,
Christian


  reply	other threads:[~2024-06-10  9:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06  9:00 [PATCH 0/6] cpuidle: teo: fixes and improvements Christian Loehle
2024-06-06  9:00 ` [PATCH 1/6] cpuidle: teo: Increase util-threshold Christian Loehle
2024-06-07  8:01   ` Dietmar Eggemann
2024-06-07  9:35     ` Christian Loehle
2024-06-09 22:47   ` Qais Yousef
2024-06-10  9:11     ` Christian Loehle [this message]
2024-06-16 21:54       ` Qais Yousef
2024-06-10  9:57     ` Ulf Hansson
2024-06-16 21:50       ` Qais Yousef
2024-06-19  9:53       ` Christian Loehle
2024-06-06  9:00 ` [PATCH 2/6] cpuidle: teo: Don't stop tick on utilized Christian Loehle
2024-06-06  9:00 ` [PATCH 3/6] cpuidle: teo: Don't always stop tick on one state Christian Loehle
2024-06-06  9:00 ` [PATCH 4/6] cpuidle: teo: Increase minimum time to stop tick Christian Loehle
2024-06-07  8:14   ` Dietmar Eggemann
2024-06-07  9:29     ` Christian Loehle
2024-06-06  9:00 ` [PATCH 5/6] cpuidle: teo: Remove recent intercepts metric Christian Loehle
2024-06-07  8:57   ` Dietmar Eggemann
2024-06-07  9:26     ` Christian Loehle
2024-06-06  9:00 ` [PATCH 6/6] cpuidle: teo: Don't count non-existent intercepts Christian Loehle
2024-06-07 10:17   ` Dietmar Eggemann
2024-06-10 11:06     ` Christian Loehle
2024-06-06 11:54 ` [PATCH 0/6] cpuidle: teo: fixes and improvements Christian Loehle
2024-06-06 12:29   ` Rafael J. Wysocki
2024-06-06 12:36     ` Christian Loehle

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=569b7923-d7ba-49a9-a88d-906f44903d20@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=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®