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>,
Aboorva Devarajan <aboorvad@linux.ibm.com>
Subject: [RFT][PATCH v1 3/5] cpuidle: menu: Tweak threshold use in get_typical_interval()
Date: Thu, 06 Feb 2025 15:25:18 +0100 [thread overview]
Message-ID: <8490144.T7Z3S40VBb@rjwysocki.net> (raw)
In-Reply-To: <1916668.tdWV9SEqCh@rjwysocki.net>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
To prepare get_typical_interval() for subsequent changes, rearrange
the use of the data point threshold in it a bit and initialize that
threshold to UINT_MAX which is more consistent with its data type.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpuidle/governors/menu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -116,7 +116,7 @@
*/
static unsigned int get_typical_interval(struct menu_device *data)
{
- unsigned int max, divisor, thresh = INT_MAX;
+ unsigned int max, divisor, thresh = UINT_MAX;
u64 avg, variance, avg_sq;
int i;
@@ -129,8 +129,8 @@
for (i = 0; i < INTERVALS; i++) {
unsigned int value = data->intervals[i];
- /* Discard data points above the threshold. */
- if (value > thresh)
+ /* Discard data points above or at the threshold. */
+ if (value >= thresh)
continue;
divisor++;
@@ -186,7 +186,7 @@
if ((divisor * 4) <= INTERVALS * 3)
return UINT_MAX;
- thresh = max - 1;
+ thresh = max;
goto again;
}
next prev parent reply other threads:[~2025-02-06 14:29 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 14:21 [RFT][PATCH v1 0/5] cpuidle: menu: Avoid discarding useful information when processing recent idle intervals Rafael J. Wysocki
2025-02-06 14:22 ` [RFT][PATCH v1 1/5] cpuidle: menu: Drop a redundant local variable Rafael J. Wysocki
2025-02-06 14:55 ` Christian Loehle
2025-02-06 14:24 ` [RFT][PATCH v1 2/5] cpuidle: menu: Use one loop for average and variance computations Rafael J. Wysocki
2025-02-17 13:03 ` Christian Loehle
2025-02-06 14:25 ` Rafael J. Wysocki [this message]
2025-02-17 13:08 ` [RFT][PATCH v1 3/5] cpuidle: menu: Tweak threshold use in get_typical_interval() Christian Loehle
2025-02-06 14:26 ` [RFT][PATCH v1 4/5] cpuidle: menu: Eliminate outliers on both ends of the sample set Rafael J. Wysocki
2025-02-17 13:26 ` Christian Loehle
2025-02-06 14:29 ` [RFT][PATCH v1 5/5] cpuidle: menu: Avoid discarding useful information Rafael J. Wysocki
2025-02-17 13:39 ` Christian Loehle
2025-02-17 13:47 ` Rafael J. Wysocki
2025-08-04 16:54 ` Marc Zyngier
2025-08-05 13:23 ` Rafael J. Wysocki
2025-08-05 14:41 ` Christian Loehle
2025-08-05 16:00 ` Marc Zyngier
2025-08-05 18:50 ` Rafael J. Wysocki
2025-08-06 7:19 ` Marc Zyngier
2025-08-06 12:48 ` Christian Loehle
2025-02-07 14:48 ` [RFT][PATCH v1 0/5] cpuidle: menu: Avoid discarding useful information when processing recent idle intervals Artem Bityutskiy
2025-02-07 15:24 ` Christian Loehle
2025-02-07 15:35 ` Rafael J. Wysocki
2025-02-07 15:45 ` Rafael J. Wysocki
2025-03-12 21:38 ` Doug Smythies
2025-02-10 14:15 ` Christian Loehle
2025-02-10 14:43 ` Rafael J. Wysocki
2025-02-10 14:47 ` Christian Loehle
2025-02-18 21:17 ` Christian Loehle
2025-02-19 12:06 ` Rafael J. Wysocki
2025-02-14 4:30 ` Doug Smythies
2025-02-14 22:10 ` Rafael J. Wysocki
2025-02-16 16:16 ` Doug Smythies
2025-02-24 6:27 ` Aboorva Devarajan
2025-02-24 6:38 ` Aboorva Devarajan
2025-02-24 12:35 ` Rafael J. Wysocki
2025-02-26 4:49 ` Aboorva Devarajan
2025-02-26 10:54 ` 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=8490144.T7Z3S40VBb@rjwysocki.net \
--to=rjw@rjwysocki.net \
--cc=aboorvad@linux.ibm.com \
--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
all inboxes | Powered by JetHome®