Skip to content

Commit

Permalink
cpufreq: add smartassV2 governor
Browse files Browse the repository at this point in the history
  • Loading branch information
erasmux authored and Brad Carter committed Sep 15, 2011
1 parent a1d775e commit b0a86fd
Show file tree
Hide file tree
Showing 5 changed files with 933 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Documentation/cpu-freq/governors.txt
Expand Up @@ -28,6 +28,7 @@ Contents:
2.3 Userspace
2.4 Ondemand
2.5 Conservative
2.7 SmartassV2

3. The Governor Interface in the CPUfreq Core

Expand Down Expand Up @@ -182,6 +183,39 @@ governor but for the opposite direction. For example when set to its
default value of '20' it means that if the CPU usage needs to be below
20% between samples to have the frequency decreased.


2.7 SmartassV2
---------------

The CPUfreq governor "smartassV2", like other governors, aims to balance
performance vs battery life by using low frequencies when load is low and
ramping the frequency when necessary, fast enough to ensure responsiveness.

The implementation of the governor is roughtly based on the idea of interactive.
The idle loop is used to track when the CPU has idle cycles. The idle loop will
set a relatively high rate timer to sample the load when appropriate, the timer
will measure the load since it was set and schedule a work queue task to do the
actual frequency change when necessary.

The most important tunable is the "ideal" frequency: this governor will aim
for this frequency, in the sense that it will ramp towards this frequency much
more aggresively than beyond it - both when ramping up from below this frequency
and when ramping down from above this frequency. Still, note, that when load is
low enough the governor should choose the lowest available frequency regardless
of the ideal frequency and similarly when load is consistently high enough the
highest available frequency will be used.

Smartass also tracks the state of the screen, and when screen is off (a.k.a
sleep or suspended in the terms of this governor) a different ideal frequency
is used. This is the only difference between the screen on and screen off
states. Proper tuning of the awake_ideal_freq and sleep_ideal_freq should
allow both high responsiveness when screen is on and utilizing the low
frequency range when load is low, especially when screen is off.

Finally, smartass is a highly customizable governor with almost everything
tweakable through the sysfs. For a detailed explaination of each tunable,
please see the inline comments at the begging of the code (smartass2.c).

3. The Governor Interface in the CPUfreq Core
=============================================

Expand Down
27 changes: 27 additions & 0 deletions drivers/cpufreq/Kconfig
Expand Up @@ -120,6 +120,12 @@ config CPU_FREQ_DEFAULT_GOV_INTERACTIVE
loading your cpufreq low-level hardware driver, using the
'interactive' governor for latency-sensitive workloads.

config CPU_FREQ_DEFAULT_GOV_SMARTASS2
bool "smartass2"
select CPU_FREQ_GOV_SMARTASS2
help
Use the CPUFreq governor 'smartassV2' as default.

endchoice

config CPU_FREQ_GOV_PERFORMANCE
Expand Down Expand Up @@ -206,4 +212,25 @@ config CPU_FREQ_GOV_CONSERVATIVE

If in doubt, say N.

config CPU_FREQ_MIN_TICKS
int "Ticks between governor polling interval."
default 10
help
Minimum number of ticks between polling interval for governors.

If in doubt, say N.

config CPU_FREQ_GOV_SMARTASS2
tristate "'smartassV2' cpufreq governor"
depends on CPU_FREQ
help
'smartassV2' - a "smart" optimized governor for the hero!

config CPU_FREQ_SAMPLING_LATENCY_MULTIPLIER
int "Sampling rate multiplier for governors."
default 1000
help
Sampling latency rate multiplied by the cpu switch latency.
Affects governor polling.

endif # CPU_FREQ
1 change: 1 addition & 0 deletions drivers/cpufreq/Makefile
Expand Up @@ -10,6 +10,7 @@ obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o
obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o
obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o
obj-$(CONFIG_CPU_FREQ_GOV_INTERACTIVE) += cpufreq_interactive.o
obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS2) += cpufreq_smartass2.o

# CPUfreq cross-arch helpers
obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o
Expand Down

0 comments on commit b0a86fd

Please sign in to comment.