Linux Power Management development
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Reka Norman <rekanorman@chromium.org>
Subject: Re: [PATCH v1 1/4] cpuidle: governors: teo: Drop incorrect target residency check
Date: Thu, 13 Nov 2025 11:32:42 +0000	[thread overview]
Message-ID: <1dc4934f-a3ce-4ead-a43c-0a80987364b6@arm.com> (raw)
In-Reply-To: <5035693.GXAFRqVoOG@rafael.j.wysocki>

On 11/12/25 16:22, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> When the target residency of the current candidate idle state is
> greater than the expected time till the closest timer (the sleep
> length), it does not matter whether or not the tick has already
> been stopped or if it is going to be stopped.  The closest timer
> will trigger anyway at its due time, so it does not make sense to
> select an idle state with target residency above the sleep length.
> 
> Accordingly, drop the teo_state_ok() check done in that case and
> let the governor use the teo_find_shallower_state() return value
> as the new candidate idle state index.
> 
> Fixes: 21d28cd2fa5f ("cpuidle: teo: Do not call tick_nohz_get_sleep_length() upfront")
> Cc: All applicable <stable@vger.kernel.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpuidle/governors/teo.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> --- a/drivers/cpuidle/governors/teo.c
> +++ b/drivers/cpuidle/governors/teo.c
> @@ -458,11 +458,8 @@ static int teo_select(struct cpuidle_dri
>  	 * If the closest expected timer is before the target residency of the
>  	 * candidate state, a shallower one needs to be found.
>  	 */
> -	if (drv->states[idx].target_residency_ns > duration_ns) {
> -		i = teo_find_shallower_state(drv, dev, idx, duration_ns, false);
> -		if (teo_state_ok(i, drv))
> -			idx = i;
> -	}
> +	if (drv->states[idx].target_residency_ns > duration_ns)
> +		idx = teo_find_shallower_state(drv, dev, idx, duration_ns, false);
>  
>  	/*
>  	 * If the selected state's target residency is below the tick length
> 
> 
> 

AFAICT this check was to not be stuck in a shallow state when tick is already disabled.
There might be a timer armed in t+500us but that might still get cancelled, which
is why we didn't think a below TICK_NSEC 'shallow' state is acceptable?

  reply	other threads:[~2025-11-13 11:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 16:21 [PATCH v1 0/4] cpuidle: governors: teo: Assorted improvements Rafael J. Wysocki
2025-11-12 16:22 ` [PATCH v1 1/4] cpuidle: governors: teo: Drop incorrect target residency check Rafael J. Wysocki
2025-11-13 11:32   ` Christian Loehle [this message]
2025-11-13 11:41     ` Rafael J. Wysocki
2025-11-13 11:47       ` Rafael J. Wysocki
2025-11-13 13:26         ` Rafael J. Wysocki
2025-11-13 13:24   ` [PATCH v2 1/4] cpuidle: governors: teo: Drop misguided " Rafael J. Wysocki
2025-11-14  9:16     ` Christian Loehle
2025-11-12 16:23 ` [PATCH v1 2/4] cpuidle: governors: teo: Drop redundant function parameter Rafael J. Wysocki
2025-11-13 11:46   ` Christian Loehle
2025-11-12 16:24 ` [PATCH v1 3/4] cpuidle: governors: teo: Use s64 consistently in teo_update() Rafael J. Wysocki
2025-11-13 11:48   ` Christian Loehle
2025-11-12 16:25 ` [PATCH v1 4/4] cpuidle: governors: teo: Decay metrics below DECAY_SHIFT threshold Rafael J. Wysocki
2025-11-12 17:29   ` Christian Loehle
2025-11-12 17:51     ` Rafael J. Wysocki
2025-11-12 18:00       ` Christian Loehle
2025-11-12 18:03   ` [PATCH v2 " Rafael J. Wysocki
2025-11-13 11:49     ` Christian Loehle
2025-11-13 15:21 ` [PATCH v1 0/4] cpuidle: governors: teo: Assorted improvements Christian Loehle
2025-11-13 15:25   ` Rafael J. Wysocki
2025-11-19 22:52   ` Doug Smythies
2025-11-20 11:02     ` Rafael J. Wysocki
2025-11-20 13:35       ` Christian Loehle
2025-11-20 13:38         ` Rafael J. Wysocki
2025-11-20 13:57           ` Rafael J. Wysocki
2025-11-20 15:21             ` Rafael J. Wysocki

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=1dc4934f-a3ce-4ead-a43c-0a80987364b6@arm.com \
    --to=christian.loehle@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rekanorman@chromium.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