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.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2023-08-12 20:52:59 -07:00 committed by Ksawlii
parent 826d5e8824
commit 900245cda2

View file

@ -95,6 +95,10 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
return true;
}
/* If the last frequency wasn't set yet then we can still amend it */
if (sg_policy->work_in_progress)
return true;
delta_ns = time - sg_policy->last_freq_update_time;
return delta_ns >= sg_policy->freq_update_delay_ns;