public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Christian Loehle <christian.loehle@arm.com>,
	Doug Smythies <dsmythies@telus.net>
Subject: [PATCH v1 2/5] cpuidle: governors: teo: Avoid fake intercepts produced by tick
Date: Wed, 14 Jan 2026 20:44:53 +0100	[thread overview]
Message-ID: <3404606.44csPzL39Z@rafael.j.wysocki> (raw)
In-Reply-To: <2257365.irdbgypaU6@rafael.j.wysocki>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Tick wakeups can lead to fake intercepts that may skew idle state
selection towards shallow states, so it is better to avoid counting
them as intercepts.

For this purpose, add a check causing teo_update() to only count
tick wakeups as intercepts if intercepts within the tick period
range are at least twice as frequent as any other events.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpuidle/governors/teo.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -239,6 +239,17 @@ static void teo_update(struct cpuidle_dr
 			cpu_data->state_bins[drv->state_count-1].hits += PULSE;
 			return;
 		}
+		/*
+		 * If intercepts within the tick period range are not frequent
+		 * enough, count this wakeup as a hit, since it is likely that
+		 * the tick has woken up the CPU because an expected intercept
+		 * was not there.  Otherwise, one of the intercepts may have
+		 * been incidentally preceded by the tick wakeup.
+		 */
+		if (3 * cpu_data->tick_intercepts < 2 * total) {
+			cpu_data->state_bins[idx_timer].hits += PULSE;
+			return;
+		}
 	}
 
 	/*




  parent reply	other threads:[~2026-01-14 19:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 19:42 [PATCH v1 0/5] cpuidle: governors: teo: Wakeup events classification change and some refinements Rafael J. Wysocki
2026-01-14 19:44 ` [PATCH v1 1/5] cpuidle: governors: teo: Avoid selecting states with zero-size bins Rafael J. Wysocki
2026-01-21 13:09   ` Christian Loehle
2026-01-23 20:46     ` Rafael J. Wysocki
2026-01-26  9:18       ` Christian Loehle
2026-01-26 11:40         ` Rafael J. Wysocki
2026-01-26 12:05           ` Christian Loehle
2026-01-14 19:44 ` Rafael J. Wysocki [this message]
2026-01-21 13:34   ` [PATCH v1 2/5] cpuidle: governors: teo: Avoid fake intercepts produced by tick Christian Loehle
2026-01-14 19:45 ` [PATCH v1 3/5] cpuidle: governors: teo: Refine tick_intercepts vs total events check Rafael J. Wysocki
2026-01-21 13:36   ` Christian Loehle
2026-01-14 19:46 ` [PATCH v1 4/5] cpuidle: governors: teo: Adjust the classification of wakeup events Rafael J. Wysocki
2026-01-14 19:47 ` [PATCH v1 5/5] cpuidle: governors: teo: Refine intercepts-based idle state lookup Rafael J. Wysocki
2026-01-16 11:52 ` [PATCH v1 0/5] cpuidle: governors: teo: Wakeup events classification change and some refinements Christian Loehle
2026-01-16 12:29   ` Rafael J. Wysocki
2026-01-19  9:53     ` Christian Loehle
2026-01-19 12:09       ` Rafael J. Wysocki
2026-01-19 16:20         ` Doug Smythies
2026-01-20 15:29 ` [Update][PATCH v1.1 4/5] cpuidle: governors: teo: Adjust the classification of wakeup events Rafael J. Wysocki
2026-01-25 17:21   ` Doug Smythies
2026-01-25 19:38     ` 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=3404606.44csPzL39Z@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=christian.loehle@arm.com \
    --cc=dsmythies@telus.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.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