cpufreq: schedutil: 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.

Change-Id: I6456d0f2ef90dd0295eb29bfd6045fdf9eb1c9fe
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Sultan Alsawaf 2023-08-12 20:52:59 -07:00 committed by Richard Raya
parent 3be4fe134f
commit 752a5ed008

View File

@ -110,6 +110,11 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
sg_policy->need_freq_update = true;
return true;
}
/* If the last frequency wasn't set yet then we can still amend it */
if (sg_policy->work_in_progress)
return true;
/* No need to recalculate next freq for min_rate_limit_us
* at least. However we might still decide to further rate
* limit once frequency change direction is decided, according