Permalink
Browse files

cpufreq: interactive: Changes to interactive governor

Changes include:
* May scale up to intermediate speeds after scaling down, rather than
scale to max speed and then only scale down until max speed needed.

* Tweaked thresholds at which max speed requested (previously CPU must
have been 100% busy since idle exit timer started, now will go max if at
least 85% busy) and default minimum sample time raised to 80ms. Tweaking
based on UI tests, still in progress.

* SMP fixes.

* Fixed attempted multiple delete of sysfs group on governor stop.
Set a just-in-case-CPU-goes-busy-again timer even if nr_running == 0 at
timer function run time, but cancel if that CPU goes idle (and don't
re-arm timer if that CPU is currently idle).

* Re-evaluate speed if a CPU goes idle while above min speed (and no timer
currently set) in case the platform requires all CPUs to be at the same
speed.

* Realtime workqueues disappeared upstream, convert speed up workqueue to
a realtime task. Average scheduling latency measured significantly less
than WQ_HIGHPRI.

* Timers are not deferrable, must wake CPU from idle, since we now
re-evaluate speed for idle CPUs.

* CPU load is computed from higher of short-term load since idle exit vs.
long-term load since last frequency change, to avoid dropping speed
during temporary dips in load on long-term-busy CPU.

* Avoid 1 CPU starting new idle exit load eval interval in a race with
timer running on another CPU.

* New fugly debugging printfs should be reworked or go away eventually.

Change-Id: I606b5c1850637c35a7814309df12362d5c044825
via: https://review.source.android.com//#change,15809
  • Loading branch information...
1 parent f5abfe1 commit af0b2a83aa595de363ec590b0621266dd810bb2b @toddpoynor toddpoynor committed with rmcc Nov 6, 2010
Showing with 470 additions and 143 deletions.
  1. +22 −13 Documentation/cpu-freq/governors.txt
  2. +6 −6 drivers/cpufreq/Kconfig
  3. +442 −124 drivers/cpufreq/cpufreq_interactive.c
@@ -187,23 +187,32 @@ default value of '20' it means that if the CPU usage needs to be below
2.6 Interactive
---------------
-The CPUfreq governor "interactive" is designed for low latency,
+The CPUfreq governor "interactive" is designed for latency-sensitive,
interactive workloads. This governor sets the CPU speed depending on
-usage, similar to "ondemand" and "conservative" governors. However
-there is no polling, or 'sample_rate' required to scale the CPU up.
-
-Sampling CPU load every X ms can lead to under powering the CPU
-for X ms, leading to dropped framerate, stuttering UI etc..
-
-Scaling the CPU up is done when coming out of idle, and like "ondemand"
-scaling up will always go to MAX, then step down based off of cpu load.
+usage, similar to "ondemand" and "conservative" governors. However,
+the governor is more aggressive about scaling the CPU speed up in
+response to CPU-intensive activity.
+
+Sampling the CPU load every X ms can lead to under-powering the CPU
+for X ms, leading to dropped frames, stuttering UI, etc. Instead of
+sampling the cpu at a specified rate, the interactive governor will
+check whether to scale the cpu frequency up soon after coming out of
+idle. When the cpu comes out of idle, a timer is configured to fire
+within 1-2 ticks. If the cpu is very busy between exiting idle and
+when the timer fires then we assume the cpu is underpowered and ramp
+to MAX speed.
+
+If the cpu was not sufficiently busy to immediately ramp to MAX speed,
+then governor evaluates the cpu load since the last speed adjustment,
+choosing th highest value between that longer-term load or the
+short-term load since idle exit to determine the cpu speed to ramp to.
There is only one tuneable value for this governor:
-min_sample_time: The ammount of time the CPU must spend (in uS)
-at the current frequency before scaling DOWN. This is done to
-more accurately determine the cpu workload and the best speed for that
-workload. The default is 50ms.
+min_sample_time: The minimum amount of time to spend at the current
+frequency before ramping down. This is to ensure that the governor has
+seen enough historic cpu load data to determine the appropriate
+workload. Default is 80000 uS.
3. The Governor Interface in the CPUfreq Core
View
@@ -115,9 +115,10 @@ config CPU_FREQ_DEFAULT_GOV_INTERACTIVE
bool "interactive"
select CPU_FREQ_GOV_INTERACTIVE
help
- Use the 'interactive' governor as default. This gets full cpu frequency
- scaling for workloads that are latency sensitive, typically interactive
- workloads..
+ Use the CPUFreq governor 'interactive' as default. This allows
+ you to get a full dynamic cpu frequency capable system by simply
+ loading your cpufreq low-level hardware driver, using the
+ 'interactive' governor for latency-sensitive workloads.
endchoice
@@ -179,9 +180,8 @@ config CPU_FREQ_GOV_ONDEMAND
config CPU_FREQ_GOV_INTERACTIVE
tristate "'interactive' cpufreq policy governor"
help
- 'interactive' - This driver adds a dynamic cpufreq policy governor.
- Designed for low latency burst workloads. Scaling it done when coming
- out of idle instead of polling.
+ 'interactive' - This driver adds a dynamic cpufreq policy governor
+ designed for latency-sensitive workloads.
config CPU_FREQ_GOV_CONSERVATIVE
tristate "'conservative' cpufreq governor"
Oops, something went wrong.

0 comments on commit af0b2a8

Please sign in to comment.