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 6/6] cpuidle: teo: Don't count non-existent intercepts
Date: Mon, 10 Jun 2024 12:06:08 +0100	[thread overview]
Message-ID: <33405fa7-7102-407e-8cc8-851c808cd47a@arm.com> (raw)
In-Reply-To: <a71314e6-b248-44a4-8a82-0a8dfde9d44f@arm.com>

On 6/7/24 11:17, Dietmar Eggemann wrote:
> On 06/06/2024 11:00, Christian Loehle wrote:
>> When bailing out early, teo will not query the sleep length anymore
>> since commit 6da8f9ba5a87 ("cpuidle: teo:
>> Skip tick_nohz_get_sleep_length() call in some cases") with an
>> expected sleep_length_ns value of KTIME_MAX.
>> This lead to state0 accumulating lots of 'intercepts' because
>> the actually measured sleep length was < KTIME_MAX, so count KTIME_MAX
>> as a hit (we have to count them as something otherwise we are stuck).
>>
>> Fundamentally we can only do one of the two:
>> 1. Skip sleep_length_ns query when we think intercept is likely
>> 2. Have accurate data if sleep_length_ns is actually intercepted when
>> we believe it is currently intercepted.
>>
>> This patch chooses that latter as I've found the additional time it
>> takes to query the sleep length to be negligible and the variants of
>> option 1 (count all unknowns as misses or count all unknown as hits)
>> had significant regressions (as misses had lots of too shallow idle
>> state selections and as hits had terrible performance in
>> intercept-heavy workloads).
> 
> So '2.' is the 'if (prev_intercept_idx != idx && !idx)' case ?
> 
> [...]

Yes, we allow the logic to bail out early, but not without querying the
expected sleep length.
(For idx > 0 the logic will continue to query the expected sleep length
later on.)

> 
>> @@ -514,6 +521,14 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>>  			first_suitable_idx = i;
>>  		}
>>  	}
>> +	if (prev_intercept_idx != idx && !idx) {
> 
> if (!idx && prev_intercept_idx) ?
> 

Thanks! I picked that up for the next version.

>> +		/*
>> +		 * We have to query the sleep length here otherwise we don't
>> +		 * know after wakeup if our guess was correct.
>> +		 */
>> +		duration_ns = tick_nohz_get_sleep_length(&delta_tick);
>> +		cpu_data->sleep_length_ns = duration_ns;
>> +	}
>>  
>>  	/*
>>  	 * If there is a latency constraint, it may be necessary to select an
> 


  reply	other threads:[~2024-06-10 11:06 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
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 [this message]
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=33405fa7-7102-407e-8cc8-851c808cd47a@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