public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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,
	anna-maria@linutronix.de, kajetan.puchalski@arm.com,
	lukasz.luba@arm.com
Subject: Re: [PATCH 4/6] cpuidle: teo: Increase minimum time to stop tick
Date: Fri, 7 Jun 2024 10:29:01 +0100	[thread overview]
Message-ID: <edffb2d4-a13d-4973-ae6f-af993a6225de@arm.com> (raw)
In-Reply-To: <c11acac7-085a-4041-a1f3-8b4f46e4b691@arm.com>

On 6/7/24 09:14, Dietmar Eggemann wrote:
> On 06/06/2024 11:00, Christian Loehle wrote:
>> Since stopping the tick isn't free, add at least some minor constant
>> (1ms) for the threshold to stop the tick.
> 
> Sounds pretty arbitrary to me? 'duration_ns' is either based on
> target_residency_ns or tick_nohz_get_sleep_length() or even set to
> TICK_NSEC/2. Does adding 1ms makes sense to all these cases? But then
> why 1ms?

It definitely is arbitrary, you're correct.
Feel free to treat this as RFC. I'll probably just drop this from the
serie and issue separately (to get the actual fixes merged more quickly).
Anyway I'd like to hear comments on this.

We are only interested in the cost of stopping the tick, which doesn't
really depend on the selected state residency nor the expected sleep length.
1ms works fine (for me!!), making it depend on TICK_NSEC would be natural,
too, but using TICK_NSEC is far too long for CONFIG_HZ=100 (and TICK_NSEC/2
too short for CONFIG_HZ=1000).
The cost of stopping the tick depends on a number of factors and knowing all
of them is probably not on the table anytime soon and until then I'd consider
this an improvement over 0.

> 
>> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
>> ---
>>  drivers/cpuidle/governors/teo.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
>> index 216d34747e3b..ca9422bbd8db 100644
>> --- a/drivers/cpuidle/governors/teo.c
>> +++ b/drivers/cpuidle/governors/teo.c
>> @@ -622,10 +622,10 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>>  	/*
>>  	 * Allow the tick to be stopped unless the selected state is a polling
>>  	 * one or the expected idle duration is shorter than the tick period
>> -	 * length.
>> +	 * length plus some constant (1ms) to account for stopping it.
>>  	 */
>>  	if ((!(drv->states[idx].flags & CPUIDLE_FLAG_POLLING) &&
>> -	    duration_ns >= TICK_NSEC) || tick_nohz_tick_stopped())
>> +	    duration_ns > NSEC_PER_MSEC + TICK_NSEC) || tick_nohz_tick_stopped())
>>  		return idx;
>>  
>>  out_tick_state:
> 


  reply	other threads:[~2024-06-07  9:29 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
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 [this message]
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=edffb2d4-a13d-4973-ae6f-af993a6225de@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