public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Doug Smythies" <dsmythies@telus.net>
To: "'Rafael J. Wysocki'" <rafael@kernel.org>,
	"'Christian Loehle'" <christian.loehle@arm.com>
Cc: "'LKML'" <linux-kernel@vger.kernel.org>,
	"'Linux PM'" <linux-pm@vger.kernel.org>,
	"Doug Smythies" <dsmythies@telus.net>
Subject: RE: [PATCH v1] cpuidle: governors: menu: Always check timers with tick stopped
Date: Tue, 27 Jan 2026 21:19:48 -0800	[thread overview]
Message-ID: <004801dc9015$b9715ec0$2c541c40$@telus.net> (raw)
In-Reply-To: <5959091.DvuYhMxLoT@rafael.j.wysocki>

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

On 2026.01.20 07:26 Rafael J. Wysocki wrote:
>From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> After commit 5484e31bbbff ("cpuidle: menu: Skip tick_nohz_get_sleep_length()
> call in some cases"), if the return value of get_typical_interval()
> multiplied by NSEC_PER_USEC is not greater than RESIDENCY_THRESHOLD_NS,
> the menu governor will skip computing the time till the closest timer.
> If that happens when the tick has been stopped already, the selected
> idle state may be too deep due to the subsequent check comparing
> predicted_ns with TICK_NSEC and causing its value to be replaced with
> the expected time till the closest timer, which is KTIME_MAX in that
> case.  That will cause the deepest enabled idle state to be selected,
> but the time till the closest timer very well may be shorter than the
> target residency of that state, in which case a shallower state should
> be used.
>
> Address this by making menu_select() always compute the time till the
> closest timer when the tick has been stopped.
>
> Also move the predicted_ns check mentioned above into the branch in
> which the time till the closest timer is determined because it only
> needs to be done in that case.
>
> Fixes: 5484e31bbbff ("cpuidle: menu: Skip tick_nohz_get_sleep_length() call in some cases")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

... snip ...

I have been testing with this patch, and have not observed any difference
in test results and energy use with and without this patch.
A couple of graphs are attached.
I did this work on top of the teo work, so those results are on the graphs also.

Legend:
rc5 = kernel 6.19-rc5
rjw = kernel 6.19-rc5 + original teo 5 patch set
rjw-1-1 = kernel 6.19-rc5 + current teo 5 patch set
(note: Not including the most recent V2 of patch 5 of 5,
now a newer 2 patch set.)
menu = kernel 6.19-rc5
menu-rjw = kernel 6.19-rc5 + this patch.
disable = all idle states except state 0 disabled, as a reference plot, at the cost of energy.


[-- Attachment #2: misses.png --]
[-- Type: image/png, Size: 41201 bytes --]

[-- Attachment #3: loop-times.png --]
[-- Type: image/png, Size: 49731 bytes --]

  parent reply	other threads:[~2026-01-28  5:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 15:26 [PATCH v1] cpuidle: governors: menu: Always check timers with tick stopped Rafael J. Wysocki
2026-01-21 13:39 ` Christian Loehle
2026-01-28  5:19 ` Doug Smythies [this message]
2026-01-28 18:05   ` 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='004801dc9015$b9715ec0$2c541c40$@telus.net' \
    --to=dsmythies@telus.net \
    --cc=christian.loehle@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.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