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

Commit b6cd9b33 authored by Rohit Gupta's avatar Rohit Gupta
Browse files

cpufreq: interactive: Reset floor_validate_time if busy at max for 100ms



When the interactive governor selects to run at max frequency it doesn't
re-schedule the timer until it hits an idle. This change checks if the CPU
has been continuously busy for last 100ms on hitting an idle start. If yes,
then floor_validate_time is reset so that the CPU stays at max frequency
for at least another 100 ms before stepping down.
This is an important feature for detecting CPU intensive workloads which
require high frequencies for achieving better performance.

Change-Id: I7d48ffbc3d50a80af9be3bf94667ee3d0120b763
Signed-off-by: default avatarRohit Gupta <rohgup@codeaurora.org>
parent 49110a93
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -93,6 +93,9 @@ static unsigned long min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
#define DEFAULT_TIMER_RATE (20 * USEC_PER_MSEC)
static unsigned long timer_rate = DEFAULT_TIMER_RATE;

/* Busy SDF parameters*/
#define MIN_BUSY_TIME (100 * USEC_PER_MSEC)

/*
 * Wait this long before raising speed above hispeed, by default a single
 * timer interval.
@@ -503,6 +506,8 @@ static void cpufreq_interactive_idle_start(void)
	struct cpufreq_interactive_cpuinfo *pcpu =
		&per_cpu(cpuinfo, smp_processor_id());
	int pending;
	int cpu = pcpu->policy->cpu;
	u64 now;

	if (!down_read_trylock(&pcpu->enable_sem))
		return;
@@ -522,8 +527,19 @@ static void cpufreq_interactive_idle_start(void)
		 * min indefinitely.  This should probably be a quirk of
		 * the CPUFreq driver.
		 */
		if (!pending)
		if (!pending) {
			cpufreq_interactive_timer_resched(pcpu);

			now = ktime_to_us(ktime_get());
			if ((pcpu->policy->cur == pcpu->policy->max) &&
				(now - pcpu->hispeed_validate_time) >
							MIN_BUSY_TIME) {
				pcpu->floor_validate_time = now;
				trace_cpufreq_interactive_idle_start(cpu,
					pcpu->target_freq, pcpu->policy->cur);
			}

		}
	}

	up_read(&pcpu->enable_sem);
+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,12 @@ DEFINE_EVENT(set, cpufreq_interactive_setspeed,
	TP_ARGS(cpu_id, targfreq, actualfreq)
);

DEFINE_EVENT(set, cpufreq_interactive_idle_start,
	TP_PROTO(u32 cpu_id, unsigned long targfreq,
	     unsigned long actualfreq),
	TP_ARGS(cpu_id, targfreq, actualfreq)
);

DECLARE_EVENT_CLASS(loadeval,
	    TP_PROTO(unsigned long cpu_id, unsigned long load,
		     unsigned long curtarg, unsigned long curactual,