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

Commit 53d56d41 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Joel Fernandes
Browse files

BACKPORT: cpufreq: schedutil: Use policy-dependent transition delays



Make the schedutil governor take the initial (default) value of the
rate_limit_us sysfs attribute from the (new) transition_delay_us
policy parameter (to be set by the scaling driver).

That will allow scaling drivers to make schedutil use smaller default
values of rate_limit_us and reduce the default average time interval
between consecutive frequency changes.

Make intel_pstate set transition_delay_us to 500.

BACKPORT: Modified to support the separate up_rate_limit_us and
down_rate_limit_us (upstream just has a single rate_limit_us). Also
dropped the changes for intel_pstate as there's a merge conflict.

Change-Id: I62a8543879a4d8582cdcb31ebd55607705d1c8b1
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
(cherry picked from commit 1b72e7fd304639f1cd49d1e11955c4974936d88c)
Signed-off-by: default avatarBrendan Jackman <brendan.jackman@arm.com>
parent 36733457
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -120,6 +120,14 @@ struct cpufreq_policy {
	bool			fast_switch_possible;
	bool			fast_switch_enabled;

	/*
	 * Preferred average time interval between consecutive invocations of
	 * the driver to set the frequency for this policy.  To be set by the
	 * scaling driver (0, which is the default, means no preference).
	 */
	unsigned int		up_transition_delay_us;
	unsigned int		down_transition_delay_us;

	 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
	unsigned int cached_target_freq;
	int cached_resolved_idx;
+13 −7
Original line number Diff line number Diff line
@@ -587,7 +587,6 @@ static int sugov_init(struct cpufreq_policy *policy)
{
	struct sugov_policy *sg_policy;
	struct sugov_tunables *tunables;
	unsigned int lat;
	int ret = 0;

	/* State should be equivalent to EXIT */
@@ -626,6 +625,12 @@ static int sugov_init(struct cpufreq_policy *policy)
		goto stop_kthread;
	}

	if (policy->up_transition_delay_us && policy->down_transition_delay_us) {
		tunables->up_rate_limit_us = policy->up_transition_delay_us;
		tunables->down_rate_limit_us = policy->down_transition_delay_us;
	} else {
		unsigned int lat;

                tunables->up_rate_limit_us = LATENCY_MULTIPLIER;
                tunables->down_rate_limit_us = LATENCY_MULTIPLIER;
		lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
@@ -633,6 +638,7 @@ static int sugov_init(struct cpufreq_policy *policy)
                        tunables->up_rate_limit_us *= lat;
                        tunables->down_rate_limit_us *= lat;
                }
	}

	policy->governor_data = sg_policy;
	sg_policy->tunables = tunables;