Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ecb4f3f authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpufreq: schedutil: Rework the fast switch limits logic"

parents 7203e74d baf191f8
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -540,15 +540,6 @@ 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;
+12 −4
Original line number Diff line number Diff line
@@ -1329,7 +1329,8 @@ static void sugov_stop(struct cpufreq_policy *policy)
static void sugov_limits(struct cpufreq_policy *policy)
{
	struct sugov_policy *sg_policy = policy->governor_data;
	unsigned long flags;
	unsigned long flags, now;
	unsigned int freq;

	if (!policy->fast_switch_enabled) {
		mutex_lock(&sg_policy->work_lock);
@@ -1341,9 +1342,16 @@ static void sugov_limits(struct cpufreq_policy *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);
		freq = policy->cur;
		now = ktime_get_ns();

		/*
		 * cpufreq_driver_resolve_freq() has a clamp, so we do not need
		 * to do any sort of additional validation here.
		 */
		freq = cpufreq_driver_resolve_freq(policy, freq);
		sg_policy->cached_raw_freq = freq;
		sugov_fast_switch(sg_policy, now, freq);
		raw_spin_unlock_irqrestore(&sg_policy->update_lock, flags);
	}