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

Commit dbb181f3 authored by Junjie Wu's avatar Junjie Wu
Browse files

cpufreq: interactive: Make skipping delay for migration optional



Commit 92352c0a ("cpufreq: interactive: Ramp up directly if
cpu_load exceeds 100") and commit 594945e6 ("cpufreq: interactive:
Skip delay in frequency changes due to migration") allow interactive
governor to skip above_hispeed_delay and min_sample_time if the
frequency evaluation request comes from scheduler. Power and performance
benefits of these two features are dependent on the behavior of each
workload. Adverse load pattern may experience regression instead of
improvement.

Make both features optional by introducing a sysfs file for each. Both
features are disabled by default.

Change-Id: I394c7fac00e6b20259dd198bd526a32ead54f14e
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent 40d14ffc
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -145,6 +145,10 @@ struct cpufreq_interactive_tunables {
	 * frequency.
	 */
	unsigned int max_freq_hysteresis;

	/* Whether to change frequency immediately for notification */
	bool fast_ramp_up;
	bool fast_ramp_down;
};

/* For cases where we have single governor instance for system */
@@ -488,7 +492,7 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif)

	if (cpu_load >= tunables->go_hispeed_load || tunables->boosted) {
		if (ppol->policy->cur < tunables->hispeed_freq &&
		    cpu_load <= MAX_LOCAL_LOAD) {
		    (!tunables->fast_ramp_up || cpu_load <= MAX_LOCAL_LOAD)) {
			new_freq = tunables->hispeed_freq;
		} else {
			new_freq = choose_freq(ppol, loadadjfreq);
@@ -503,7 +507,7 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif)
			new_freq = tunables->hispeed_freq;
	}

	if (cpu_load <= MAX_LOCAL_LOAD &&
	if ((!tunables->fast_ramp_up || cpu_load <= MAX_LOCAL_LOAD) &&
	    ppol->policy->cur >= tunables->hispeed_freq &&
	    new_freq > ppol->policy->cur &&
	    now - ppol->hispeed_validate_time <
@@ -526,7 +530,8 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif)

	new_freq = ppol->freq_table[index].frequency;

	if (!is_notif && new_freq < ppol->target_freq &&
	if ((!tunables->fast_ramp_down || !is_notif) &&
	    new_freq < ppol->target_freq &&
	    now - ppol->max_freq_hyst_start_time <
	    tunables->max_freq_hysteresis) {
		trace_cpufreq_interactive_notyet(max_cpu, cpu_load,
@@ -539,7 +544,8 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif)
	 * Do not scale below floor_freq unless we have been at or above the
	 * floor frequency for the minimum sample time since last validated.
	 */
	if (!is_notif && new_freq < ppol->floor_freq) {
	if ((!tunables->fast_ramp_down || !is_notif) &&
	    new_freq < ppol->floor_freq) {
		if (now - ppol->floor_validate_time <
				tunables->min_sample_time) {
			trace_cpufreq_interactive_notyet(
@@ -931,6 +937,8 @@ static ssize_t store_##file_name( \
}
show_store_one(max_freq_hysteresis);
show_store_one(align_windows);
show_store_one(fast_ramp_up);
show_store_one(fast_ramp_down);

static ssize_t show_go_hispeed_load(struct cpufreq_interactive_tunables
		*tunables, char *buf)
@@ -1323,6 +1331,8 @@ show_store_gov_pol_sys(use_sched_load);
show_store_gov_pol_sys(use_migration_notif);
show_store_gov_pol_sys(max_freq_hysteresis);
show_store_gov_pol_sys(align_windows);
show_store_gov_pol_sys(fast_ramp_up);
show_store_gov_pol_sys(fast_ramp_down);

#define gov_sys_attr_rw(_name)						\
static struct global_attr _name##_gov_sys =				\
@@ -1350,6 +1360,8 @@ gov_sys_pol_attr_rw(use_sched_load);
gov_sys_pol_attr_rw(use_migration_notif);
gov_sys_pol_attr_rw(max_freq_hysteresis);
gov_sys_pol_attr_rw(align_windows);
gov_sys_pol_attr_rw(fast_ramp_up);
gov_sys_pol_attr_rw(fast_ramp_down);

static struct global_attr boostpulse_gov_sys =
	__ATTR(boostpulse, 0200, NULL, store_boostpulse_gov_sys);
@@ -1374,6 +1386,8 @@ static struct attribute *interactive_attributes_gov_sys[] = {
	&use_migration_notif_gov_sys.attr,
	&max_freq_hysteresis_gov_sys.attr,
	&align_windows_gov_sys.attr,
	&fast_ramp_up_gov_sys.attr,
	&fast_ramp_down_gov_sys.attr,
	NULL,
};

@@ -1399,6 +1413,8 @@ static struct attribute *interactive_attributes_gov_pol[] = {
	&use_migration_notif_gov_pol.attr,
	&max_freq_hysteresis_gov_pol.attr,
	&align_windows_gov_pol.attr,
	&fast_ramp_up_gov_pol.attr,
	&fast_ramp_down_gov_pol.attr,
	NULL,
};