From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Christian Loehle <christian.loehle@arm.com>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Subject: [PATCH v1 4/4] cpuidle: teo: Combine candidate state index checks against 0
Date: Fri, 10 Jan 2025 13:56:07 +0100 [thread overview]
Message-ID: <2296767.iZASKD2KPV@rjwysocki.net> (raw)
In-Reply-To: <4953183.GXAFRqVoOG@rjwysocki.net>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
There are two candidate state index checks against 0 in teo_select()
that need not be separate, so combine them and update comments around
them.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpuidle/governors/teo.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -436,25 +436,25 @@
if (idx > constraint_idx)
idx = constraint_idx;
- if (!idx && prev_intercept_idx &&
- !(drv->states[0].flags & CPUIDLE_FLAG_POLLING)) {
+
+ if (!idx) {
/*
- * We have to query the sleep length here otherwise we don't
- * know after wakeup if our guess was correct.
+ * Skip the timers check if state 0 is the current candidate
+ * one because an immediate non-timer wakeup is expected then.
*/
- duration_ns = tick_nohz_get_sleep_length(&delta_tick);
- cpu_data->sleep_length_ns = duration_ns;
+ if (prev_intercept_idx &&
+ !(drv->states[0].flags & CPUIDLE_FLAG_POLLING)) {
+ /*
+ * Query the sleep length to be able to count the wakeup
+ * as a hit if it is caused by a timer.
+ */
+ duration_ns = tick_nohz_get_sleep_length(&delta_tick);
+ cpu_data->sleep_length_ns = duration_ns;
+ }
goto out_tick;
}
/*
- * Skip the timers check if state 0 is the current candidate one,
- * because an immediate non-timer wakeup is expected in that case.
- */
- if (!idx)
- goto out_tick;
-
- /*
* If state 0 is a polling one, check if the target residency of
* the current candidate state is low enough and skip the timers
* check in that case too.
prev parent reply other threads:[~2025-01-10 12:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 12:51 [PATCH v1 0/4] cpuidle: teo: Fix and cleanups Rafael J. Wysocki
2025-01-10 12:53 ` [PATCH v1 1/4] cpuidle: teo: Add polling flag check to early return path Rafael J. Wysocki
2025-01-10 13:16 ` Christian Loehle
2025-01-10 13:34 ` Rafael J. Wysocki
2025-01-10 14:52 ` Christian Loehle
2025-01-10 15:17 ` Rafael J. Wysocki
2025-01-10 17:23 ` Rafael J. Wysocki
2025-01-23 16:54 ` Artem Bityutskiy
2025-01-23 18:12 ` Rafael J. Wysocki
2025-01-10 12:54 ` [PATCH v1 2/4] cpuidle: teo: Rearrange idle state lookup code Rafael J. Wysocki
2025-01-10 12:55 ` [PATCH v1 3/4] cpuidle: teo: Reorder candidate state index checks Rafael J. Wysocki
2025-01-10 12:56 ` Rafael J. Wysocki [this message]
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=2296767.iZASKD2KPV@rjwysocki.net \
--to=rjw@rjwysocki.net \
--cc=artem.bityutskiy@linux.intel.com \
--cc=christian.loehle@arm.com \
--cc=daniel.lezcano@linaro.org \
--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