[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f949565ef1f256a1641cea3fa1d01d126bcc32e8.camel@linux.ibm.com>
Date: Wed, 26 Feb 2025 10:19:14 +0530
From: Aboorva Devarajan <aboorvad@...ux.ibm.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux PM
<linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Daniel Lezcano
<daniel.lezcano@...aro.org>,
Christian Loehle <christian.loehle@....com>,
Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>,
aboorvad@...ux.ibm.com
Subject: Re: [RFT][PATCH v1 0/5] cpuidle: menu: Avoid discarding useful
information when processing recent idle intervals
On Mon, 2025-02-24 at 11:57 +0530, Aboorva Devarajan wrote:
> On Thu, 2025-02-06 at 15:21 +0100, Rafael J. Wysocki wrote:
>
>
>
>
> So for the entire series:
>
> Tested-by: Aboorva Devarajan <aboorvad@...ux.ibm.com>
>
> I'm also trying a minimal unit fuzz-test with the pre- and post- patched version of the get_typical_interval
> function to understand this better, will post the results soon.
>
>
In addition to the previous tests, I also reviewed and tested how get_typical_interval
predicts the idle duration before and after the patch by mimicking the function in
userspace for better unit fuzz testing [1].
With the patch get_typical_interval function now produces more predictable values, whereas
in the previous implementation it frequently returned UINT_MAX. The behavior with the patch
seems to be more reasonable compared to before.
Here are the test results
1. Low Variance:
When the history of CPU idle durations (8 intervals) is relatively uniform with low variance,
the predicted idle duration is unchanged between the patched and unpatched versions:
| Test Case | Intervals | Before | After | Difference |
|-----------|----------------------------------------------|--------|-------|------------|
| 1 | 100,105,110,115,120,125,130,135 | 117 | 117 | 0 |
| 2 | 200,205,210,215,220,225,230,235 | 217 | 217 | 0 |
| 3 | 500,505,510,515,520,525,530,535 | 517 | 517 | 0 |
| 4 | 1000,1005,1010,1015,1020,1025,1030,1035 | 1017 | 1017 | 0 |
2. High Variance
For cases with high variance, the nonpatched function returned UINT_MAX,
After the patch, the function now returns reasonable values:
| Test Case | Intervals | Before | After | Difference |
|-----------|--------------------------------------------|-------------|-------|------------------|
| 5 | 99,198,297,396,495,594,693,792 | 4294967295 | 594 | -4294966701 |
| 6 | 1000,2000,3000,4000,5000,6000,7000,8000 | 4294967295 | 6000 | -4294961295 |
| 7 | 40,140,240,340,440,540,640,740 | 4294967295 | 540 | -4294966755 |
| 8 | 90,590,1090,1590,2090,2590,3090,3590 | 4294967295 | 2590 | -4294964705 |
| 9 | 42,142,242,342,442,542,642,742 | 4294967295 | 542 | -4294966753 |
| 10 | 70,570,1070,1570,2070,2570,3070,3570 | 4294967295 | 2570 | -4294964725 |
| 11 | 44,144,244,344,444,544,644,744 | 4294967295 | 544 | -4294966751 |
3. Low-end Outliers
The patch removes variance from low-end values as well,
Without the patch, the function only filtered high-end outliers, but now it correctly eliminates both
high and low ends.
| Test Case | Intervals | Before | After | Difference |
|-----------|-------------------------------------------|-------------|-------|-------------|
| 12 | 1,200,200,250,250,230,220,260 | 4294967295 | 230 | -4294967065 |
| 13 | 100000,200,200,250,250,230,220,260 | 230 | 230 | 0 |
4. As far as I understand, the function only returns UINT_MAX when all values are 0, negative, or the
computed average itself is UINT_MAX.
| Test Case | Intervals | Before | After | Difference |
|-----------|---------------------------------------------|-------------|-------------|------------|
| 14 | 4294967295,4294967295,4294967295,4294967295 | 4294967295 | 4294967295 | 0 |
| 15 | 0,0,0,0,0,0,0,0 | 4294967295 | 4294967295 | 0 |
The updated get_typical_interval function avoids unnecessary UINT_MAX returns, handles both low and high end
outliers, and gives more reliable predictions in high-variance cases. It only returns UINT_MAX when absolutely
necessary, and this will help in not selecting deeper idle state unless it is needed. So, I'm good with
the patch.
Refer [2] for more test results.
[1] - https://github.com/AboorvaDevarajan/linux-utils/blob/main/cpuidle/cpuidle-predict-duration/predict_cpuidle_interval.c
[2] - https://github.com/AboorvaDevarajan/linux-utils/blob/main/cpuidle/cpuidle-predict-duration/out.predict.csv
Thanks,
Aboorva
Powered by blists - more mailing lists