kernel: ems/ego: Allow CPU frequency changes to be amended before they're set

If the last CPU frequency selected isn't set before a new CPU frequency
selection arrives, then use the new selection immediately to avoid using a
stale frequency choice. This improves both performance and energy by more
closely tracking the scheduler's latest decisions.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[Flopster101: Adapted to Exynos energy_aware governor]
Signed-off-by: Nahuel Gómez <nahuelgomez329@gmail.com>
This commit is contained in:
Sultan Alsawaf 2023-08-12 20:52:59 -07:00 committed by Ksawlii
parent 51d3ee0bf3
commit 5d1ef2f0ad

View file

@ -473,6 +473,10 @@ static bool ego_should_update_freq(struct ego_policy *egp, u64 time)
*/
rate_limit_ns = min(egp->up_rate_limit_ns, egp->down_rate_limit_ns);
/* If the last frequency wasn't set yet then we can still amend it */
if (egp->work_in_progress)
return true;
return delta_ns >= rate_limit_ns;
}