Skip to content

Commit

Permalink
cpufreq: schedutil: Add fast switch to sugov_limits path
Browse files Browse the repository at this point in the history
When new cpufreq min/max limits are set, the expectation is that the CPU
frequency will be updated appropriately.  This happens for targets which do
not utilize the cpufreq fast switch APIs, but the code to do this is not
present by default for the fast switch path.  Add the necessary code to
update frequency to reflect the new cpufreq limits for targets with fast
switch enabled.

Change-Id: I211b6117005df9d340dfe0d825032cd7600cbffa
Signed-off-by: Jonathan Avila <[email protected]>
  • Loading branch information
Jonathan Avila authored and Gerrit - the friendly Code Review server committed Jul 5, 2019
1 parent 35c5cb2 commit c458a23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/linux/cpufreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,15 @@ static inline void cpufreq_policy_apply_limits(struct cpufreq_policy *policy)
__cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L);
}

static inline void cpufreq_policy_apply_limits_fast(struct cpufreq_policy
*policy)
{
if (policy->max < policy->cur)
cpufreq_driver_fast_switch(policy, policy->max);
else if (policy->min > policy->cur)
cpufreq_driver_fast_switch(policy, policy->min);
}

/* Governor attribute set */
struct gov_attr_set {
struct kobject kobj;
Expand Down
6 changes: 6 additions & 0 deletions kernel/sched/cpufreq_schedutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,12 @@ static void sugov_limits(struct cpufreq_policy *policy)
raw_spin_unlock_irqrestore(&sg_policy->update_lock, flags);
cpufreq_policy_apply_limits(policy);
mutex_unlock(&sg_policy->work_lock);
} else {
raw_spin_lock_irqsave(&sg_policy->update_lock, flags);
sugov_track_cycles(sg_policy, sg_policy->policy->cur,
ktime_get_ns());
cpufreq_policy_apply_limits_fast(policy);
raw_spin_unlock_irqrestore(&sg_policy->update_lock, flags);
}

sg_policy->need_freq_update = true;
Expand Down

0 comments on commit c458a23

Please sign in to comment.