Skip to content

Commit ddcfa79

Browse files
committed
cpuidle: teo: Simplify handling of total events count
Instead of computing the total events count from scratch every time, decay it and add a PULSE value to it in teo_update(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Christian Loehle <[email protected]> Tested-by: Aboorva Devarajan <[email protected]> Tested-by: Christian Loehle <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 13ed5c4 commit ddcfa79

File tree

1 file changed

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

1 file changed

+1
-4
lines changed

drivers/cpuidle/governors/teo.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
189189
}
190190
}
191191

192-
cpu_data->total = 0;
193-
194192
/*
195193
* Decay the "hits" and "intercepts" metrics for all of the bins and
196194
* find the bins that the sleep length and the measured idle duration
@@ -202,8 +200,6 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
202200
bin->hits -= bin->hits >> DECAY_SHIFT;
203201
bin->intercepts -= bin->intercepts >> DECAY_SHIFT;
204202

205-
cpu_data->total += bin->hits + bin->intercepts;
206-
207203
target_residency_ns = drv->states[i].target_residency_ns;
208204

209205
if (target_residency_ns <= cpu_data->sleep_length_ns) {
@@ -228,6 +224,7 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
228224
cpu_data->tick_intercepts += PULSE;
229225
}
230226

227+
cpu_data->total -= cpu_data->total >> DECAY_SHIFT;
231228
cpu_data->total += PULSE;
232229
}
233230

0 commit comments

Comments
 (0)