Skip to content

Commit

Permalink
Add Interactive, Smartass and SmartassV2 kernel power governors
Browse files Browse the repository at this point in the history
Put Smartassv2 as default governor
Smartass credits to Erasmux
  • Loading branch information
KalimochoAz authored and Rhcp committed Feb 3, 2012
1 parent f14103b commit 00aedbd
Show file tree
Hide file tree
Showing 8 changed files with 2,386 additions and 7 deletions.
70 changes: 70 additions & 0 deletions Documentation/cpu-freq/governors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Contents:
2.3 Userspace
2.4 Ondemand
2.5 Conservative
2.6 Interactive
2.7 SmartassV2

3. The Governor Interface in the CPUfreq Core

Expand Down Expand Up @@ -182,6 +184,74 @@ 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.6 Interactive
---------------

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,
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.

The tuneable value for this governor are:

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.

go_maxspeed_load: The CPU load at which to ramp to max speed. Default
is 85.

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
54 changes: 52 additions & 2 deletions arch/arm/configs/herring_defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.35.14
# Wed Sep 21 05:31:08 2011
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_ARCH_USES_GETTIMEOFFSET=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_NO_IOPORT=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_ARCH_HAS_CPUFREQ=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_FIQ=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_ARM_L1_CACHE_SHIFT_6=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SYSVIPC=y
Expand Down Expand Up @@ -32,11 +68,25 @@ CONFIG_PREEMPT=y
CONFIG_AEABI=y
CONFIG_CMDLINE="console=ttyFIQ0"
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_LOG=y
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_TABLE=y
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS2=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
CONFIG_CPU_FREQ_GOV_SMARTASS=y
CONFIG_CPU_FREQ_GOV_SMARTASS2=y
CONFIG_CPU_IDLE=y
CONFIG_VFP=y
CONFIG_NEON=y
Expand Down
40 changes: 40 additions & 0 deletions drivers/cpufreq/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,28 @@ config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
Be aware that not all cpufreq drivers support the conservative
governor. If unsure have a look at the help section of the
driver. Fallback governor will be the performance governor.

config CPU_FREQ_DEFAULT_GOV_INTERACTIVE
bool "interactive"
select CPU_FREQ_GOV_INTERACTIVE
help
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.

config CPU_FREQ_DEFAULT_GOV_SMARTASS
bool "smartass"
select CPU_FREQ_GOV_SMARTASS
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'smartass' as default.

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 @@ -190,4 +212,22 @@ config CPU_FREQ_GOV_CONSERVATIVE

If in doubt, say N.

config CPU_FREQ_GOV_INTERACTIVE
tristate "'interactive' cpufreq policy governor"
help
'interactive' - This driver adds a dynamic cpufreq policy governor
designed for latency-sensitive workloads.

config CPU_FREQ_GOV_SMARTASS
tristate "'smartass' cpufreq governor"
depends on CPU_FREQ

config CPU_FREQ_GOV_SMARTASS2
tristate "'smartassV2' cpufreq governor"
depends on CPU_FREQ
help
'smartassV2' - a "smart" governor
If in doubt, say N.

endif # CPU_FREQ

3 changes: 3 additions & 0 deletions drivers/cpufreq/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o
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_SMARTASS) += cpufreq_smartass.o
obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS2) += cpufreq_smartass2.o

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

0 comments on commit 00aedbd

Please sign in to comment.