Skip to content

Commit 60256e4

Browse files
committed
cpuidle: menu: Tweak threshold use in get_typical_interval()
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 <[email protected]> Tested-by: Artem Bityutskiy <[email protected]> Reviewed-by: Christian Loehle <[email protected]> Tested-by: Christian Loehle <[email protected]> Tested-by: Aboorva Devarajan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 1398292 commit 60256e4

File tree

1 file changed

+4
-4
lines changed
  • drivers/cpuidle/governors

1 file changed

+4
-4
lines changed

drivers/cpuidle/governors/menu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev);
116116
*/
117117
static unsigned int get_typical_interval(struct menu_device *data)
118118
{
119-
unsigned int max, divisor, thresh = INT_MAX;
119+
unsigned int max, divisor, thresh = UINT_MAX;
120120
u64 avg, variance, avg_sq;
121121
int i;
122122

@@ -129,8 +129,8 @@ static unsigned int get_typical_interval(struct menu_device *data)
129129
for (i = 0; i < INTERVALS; i++) {
130130
unsigned int value = data->intervals[i];
131131

132-
/* Discard data points above the threshold. */
133-
if (value > thresh)
132+
/* Discard data points above or at the threshold. */
133+
if (value >= thresh)
134134
continue;
135135

136136
divisor++;
@@ -186,7 +186,7 @@ static unsigned int get_typical_interval(struct menu_device *data)
186186
if ((divisor * 4) <= INTERVALS * 3)
187187
return UINT_MAX;
188188

189-
thresh = max - 1;
189+
thresh = max;
190190
goto again;
191191
}
192192

0 commit comments

Comments
 (0)