[Android Q&A, Help & Troubleshooting] ShivaY:
CPU Governors, Hotplug drivers and GPU governors Explained Part 3 (Updated 30/12/16)

--------------------------------------------------------------------------------------------------------------------------------------------

Official XDA thread Of The Contributer: http://xdaforums.com/member.php?u=5811506

Edited By ShivaY: http://xdaforums.com/member.php?u=6704044

Guide Part 1 Link: http://xdaforums.com/lenovo-a6000/how-to/cpu-governors-hotplug-drivers-gpu-t3528762

Guide Part 2 Link: http://xdaforums.com/lenovo-a6000/how-to/cpu-governors-hotplug-drivers-gpu-t3528766

Guide Part 4 Link : http://xdaforums.com/lenovo-a6000/how-to/cpu-governors-hotplug-drivers-gpu-t3528772

Here I've gathered some info for newcomers to the Android world.I've tried to keep it relatively simple. So if you want more info Comment Below

Recommended apps for manipulating kernel values:

1. Kernel Adiutor (Free to change governor and tune variables)

2. Kernel Adiutor-Mod (Free to change governor and tune variables)

3. Compatible kernel managers (e.g Stweaks, Synapse, UKM, etc.)

Hotplug drivers:

------------------------

mpdecision: Qualcomm's default hotplugging driver. One of the most widely used hotplug drivers in all android devices.

msm_hotplug: Great battery life, a custom qualcomm based hotplugging driver by myflux. It is a popular choice for many users.

intelliplug: Great balance between battery life and performance. It is also a popular hotplug driver from faux123.

Alucard: A great hotplugging driver by Alucard. It is known to be very battery friendly on devices.

Kt Auto Hotplug: A great hotplug driver by Ktoonsez. Pretty much a smarter mpdecision that has been optimized for quad-core devices.

Mako Hotplug: A new popular hotplugging driver found in Francokernel. This is a highly configurable driver that can be configured to use dual core for light-loads and quad-core for heavy loads.

Zen Decision: ZEN only onlines all cores when screen is on, it also takes thermal events into account and wont online any core back, if you're under 15% battery, or currently have a thermal event because of heat. So in the end it isn't a "real" hotplug driver, because it doesnt have any code for active hot plugging in it. That means you can't change its behavior.

Bricked Hotplug: Conservative hotplug driver by [MENTION=358990]show[/MENTION]p1984. It is based on mpdecision but has been optimized for better balance between battery life and performance.

msm_sleeper: The main feature with this hotplug is that you can customize the screen off frequency. Two cores are always on, the third and fourth are independent and come online if needed. By default, if the load is over 80 for 400ms another core comes online. The third and/or fourth cores stay online as long as the load demands it or for a minimum of one second. While the screen is off, it goes down to a single core. Created by flar2.

Autosmp: A highly-efficient hotplug driver by [MENTION=4203114]mrg666[/MENTION], works in-sync with the CPU governor to enable off-line cpu cores when the the CPU frequency reaches a high threshold and still more compute power is needed. Therefore, touch boost bloat is removed.

Thunderplug: A matured load-based hotplug driver with many tunables written from ground up by varun.chitre15. This hotplug is optimized for octa-core devices and also has support for 64bit CPUs.

Blu_plug: Dynamic hotplug from eng.stk's shamu kernel with screenoff battery saving.

cpuquiet: A hotplug driver by NVidia and ported to Snapdragon by maxwen. Originally made for NVidia tegra SOCs. It has a set of governors which keep the CPU running at optimal frequencies for battery and performance.

Fast hotplug: A hotplug driver from pec0ra's abricot kernel. It aims to be as lightweight as possible while also being highly customizable. However, it is still a WIP as it is known to have some stability issues.

Hima hotplug: An optimized hotplug driver based on intelliplug for big.LITTLE architecture. Found on chadouming's HTC One (M9) kernel, it takes advantage of the big and LITTLE CPU cores in order to provide 'butter smooth' performance.

State Helper: A hotplug driver by [MENTION=3795148]neobuddy89[/MENTION] designed with the Nexus 6 in mind. It is highly configurable giving the user control over what CPUs to online based on what battery threshold levels have been set. Another feature that sets state helper apart from other hotplug methods is that it respects the thermal driver.

ZZmoove native hotplug: The hotplugging logic found in the ZZmoove governor. This isn't a standalone hotplug driver that can be used with other governors, the hotplugging is done by the governor which was common on older devices like the Samsung Galaxy S3. Native hotplugging may offer better stability and the governor should perform better in battery life and performance (your experience may vary) because it was designed for this specific governor.

Custom kernels may have their own hotplugging drivers but they are usually based on these ones.

Battery life:

mpdecision

Mako Hotplug

Intelliplug

Alucard

For performance:

mpdecision

For balanced:

Bricked Hotplug

Mako Hotplug

Intelliplug

mpdecision

GPU governors

-----------------------

Simple: An open-source alternative to Qualcomm's closed-sourced governors. Developed by Faux123, it is highly customisable which will allow more fine-grained control over how the GPU scales up and down.

simple_ondemand: As the name implies, it is a simpler version of the CPU governor ondemand. simple_ondemand will ramp up the frequency when a load is detected. It has a good balance between performance and battery savings.

msm-adreno-tz: The default GPU governor used by Qualcomm for their adreno GPUs. It is based on the ondemand governor but is biased towards performance, therefore it should give better performance in games but less battery life.

Performance: As the name suggests, this keeps your GPU running at the max frequency. This is a governor if you want the best possible experience in games but you don't care about your battery life.

Powersave: Like the CPU governor, this keeps your GPU running at the lowest possible frequency. Best battery life, extreme lag in games.

Adreno Idler: It is an idling algorithm, an efficient workaround for msm-adreno-tz's overheads. Main goal is to lower the power consumptions while maintaining high-performance. Since msm-adreno-tz tends to *not* use the lowest frequency even on idle, Adreno idler replaces msm-adreno-tz's algorithm when it comes to calculating idle frequency(mostly by ondemand's method). The higher frequencies are not touched with this algorithm, so high-demanding games will (most likely) not suffer from worsened performance.

Userspace: This governor basically allows the user is able to set a desired frequency for the GPU to run at.

cpubw_hwmon: A hardware monitor based governor that attempts to determine bandwidth (BW) needed by CPU and other hardware. Because it samples bandwidth using polling intervals, it has been made to be biased towards performance to compensate for the possible slower response times during heavy loads.

MSM Cpufreq: The MSM CPUfreq governor determines the CPU to DDR bandwidth vote based on the current CPU frequency of all the active CPUs. In other words, this governor scales based on CPU usage which could mean more performance.

Governor types:

----------------------

All governors are coded to behave on certain principles which can affect the performance, battery life, stability of your device. I won't be updating this guide often because there is simply too many governors.

1) Ondemand Based:

Works on "ramp-up on high load" principle. CPU busy-time is taken into consideration for scaling decisions. Members: Ondemand, OndemandX, Intellidemand, Lazy, Lagfree, PegasusQ, HYPER, Wheatley, Hotplug, HotplugX, AbyssPlug, AbyssPlugv2, Nightmare, Sleepy.

2) Conservative Based:

Works by biasing the phone to prefer the lowest possible clockspeed as often as possible. Members: Conservative, Lionheart, LionheartX

3) Interactive Based:

Works on "make scaling decision when CPU comes out of idle-loop" principle. Members: Interactive, InteractiveX, Intelliactive, Lulzactive, Luzactiveq, Smartass, SmartassV2, SmartassH3, Brazilianwax, SavagedZen, Dyninteractive, Interactive Pro

4) Unique Category:

These do not fall into any other category above and/or possess unique attributes. Members: Userspace, Powersave, Performance, Min Max, ZZmove, MSM DCVS, IntelliMM

5) Hybrid Category:

These have a mix of two (or more) CPU governor behaviors. Members: Smartmax, Dancedance, Performance May Cry(PMC), Ktoonservative, KtoonservativeQ

Recommendations:

-----------------------------

For performance:

Interactive/InteractiveX

Intelliactive

Performance

ElementalX

HYPER

Lionheart/LionheartX

Blu_active

For battery life:

Ondemand

Conservative

Perfomance may cry (PMC)

Powersave

Smartmax

Intellimm

Alucard

For balanced battery life and performance:

Interactive/InteractiveX

Intelliactive

Ondemand/Ondemand

ElementalX

Yankactive/YanksusQ

PegasusQ

HYPER

Impulse

ZZMoove

For gaming:

Interactive/InteractiveX

Intelliactive

Performance

Lionheart/LionheartX

PegasusQ

ElementalX

Ondemand/OndemandX

HYPER

Individual-core CPU governor selection

Some kernels will allow you to set a governor on a per-core basis. This can introduce a wider range of configurations which can alter the scaling of specific part of the CPU. While there is no definite guidelines on how to achieve optimal settings, here are some configurations you can do:

All cores running the same governor:

This will give the best stability and the CPU will behave as expected. This is the stock default on all devices.

All cores running different governors:

You should probably avoid this because it can cause stabilities and can significantly affect the performance and battery life of your CPU. Most kernel developers may not even provide support because there are too many combinations to choose from and because of the risks associated with this setup.

big.LITTLE cores running two different governors:

Similar to the previous setup, this could cause instabilities on your device and could affect how well your CPU performs. It is better just to use the same governor across all cores but there have been some setups like this.

CPU governor tunables

--------------------------------

NOTE: If you don't have some of these tunables, you might have an older version of the governor/hotplug driver and/or the kernel maintainer has made modifications to it.

1. ONDEMAND

[ PARAMETERS ]

Quote:

i) sampling_rate - Measured in uS , this is how often the kernel look at the CPU usage and make decisions on what to do about the frequency. Higher values means CPU polls less often. For lower frequencies, this could be considered an advantage since it might not jump to next frequency very often, but for higher frequencies, the scale-down time will be increased.

ii) up_threshold - defines what the average CPU usage between the samplings of 'sampling_rate' needs to be for the kernel to make a decision on whether it should increase the frequency. For example when it is set to its default value of '95' it means that between the checking intervals the CPU needs to be on average more than 95% in use to then

decide that the CPU frequency needs to be increased.

iii) powersave_bias - Default value is 0. Setting a higher value will bias the governor towards lower frequency steps. Use this if you want CPU to spend less time on higher frequencies. A better alternative would be to underclock to a lower frequency than using powersave bias.

iv) sampling_down_factor - Determines how often CPU should stay at higher frequencies when truly busy. Default behavior is fast switching to lower frequencies (1). Having sampling_down_factor set to 1 makes no changes from existing behavior (for the non-modified ondemand), but having sampling_down_factor set to a value greater than 1 causes it to act as a multiplier for the scheduling interval for re-evaluating the load when the CPU is at its highest clock frequency (which is scaling_max_freq) due to high load. T

v) down_differential - Indirectly calculates the 'down-threshold' of Ondemand. After completing sampling-down-factor*sampling-rate at max frequency because of high load, governor samples the load again to calculate an estimate of the new target frequency in a way that the lowest frequency will be chosen that would not trigger up_threshold in the next sample. Because triggering up-threshold will again cause CPU to scale up to max frequency. During this choice down_differential is taken into account as a breathing room value. Target frequency is calculated as max_load_freq / (up_threshold - down_differential).

vi) freq_step - Whenever up-scaling logic is triggered the governor instructs the CPU to raise its frequency by freq_step percentage of max allowed frequency. (max policy * (freq step / 100)). Ex: max policy is 1600 and freq step 21%, it will scale 1600 * 21% = 336.

vii) ignore_nice_load - this parameter takes a value of '0' or '1'. When set to '0' (its default), all processes are counted towards the 'cpu utilisation' value. When set to '1', the processes that are run with a 'nice' value will not count (and thus be ignored) in the overall usage calculation. This is useful if you are running a CPU intensive calculation on your laptop that you do not care how long it takes to complete as you can 'nice' it and prevent it from taking part in the deciding process of whether to increase your CPU frequency.

viii) sampling_rate_min -

The sampling rate is limited by the HW transition latency:

transition_latency * 100

Or by kernel restrictions:

If CONFIG_NO_HZ is set, the limit is 10ms fixed.

If CONFIG_NO_HZ is not set or nohz=off boot parameter is used, the

limits depend on the CONFIG_HZ option:

HZ=1000: min=20000us (20ms)

HZ=250: min=80000us (80ms)

HZ=100: min=200000us (200ms)

The highest value of kernel and HW latency restrictions is shown and

used as the minimum sampling rate.

2. LULZACTIVE/LULZACTIVEQ

1. Initial Version:-

[ PARAMETERS ]

Quote:

i) down_sampling_time - Sampling time to scale cpu down.

ii) up_sampling_time - Sampling time to scale cpu up.

2. Second Version (LulzactiveQ):-

[ PARAMETERS ]

Quote:

i) inc_cpu_load - In previous version, this was 'hard-coded' to 60. Now it's user-configurable. The frequency at which governor scales CPU up/down. Load < inc_cpu_load: cpu scaled down. Load >= inc_cpu_load: cpu scaled up

ii) pump_up_step - No of scale up steps when load >= inc_cpu_load

iii) pump_down_step - No of scale down steps when load < inc_cpu_load

iv) screen_off_min_step - Steps in frequency table to be used when screen-off. Example: If available freqs are 1600 1400 1200 1000 800 500 200 100 (L0 to L7) and screen_off_min_step=5 then 100,200 and 500 (L5 to L7) will be used during screen-off depending on the demand.

v) up_sample_time - same as initial version. (Allowed values 10,000 to 50,000)

vi) down_sample_time - same as older version. (Allowed values 10,000 to 100,000)

3. SMARTASSV2

[ PARAMETERS ]

Quote:

i) awake_ideal_freq - The frequency until which CPU is scaled up rapidly on screen-awake (from sleep). Thereafter, scaling up is less aggressive.

ii) sleep_ideal_freq - The frequency until which CPU is scaled down rapidly when screen is turned off. Thereafter, scaling down is less aggressive.

iii) up_rate_us - The minimum amount of time to spend at a frequency before we can ramp up. (Ignored below awake-ideal frequency since governor needs to rapidly scale up to awake_ideal_freq when below it)

iv) down_rate_us - The minimum amount of time to spend at a frequency before we can ramp down. (Ignored above sleep-ideal frequency since governor needs to rapidly scale down to sleep_ideal_freq when above it)

v) max_cpu_load - Same as up_threshold in other governors.

vi) min_cpu_load - Same as down_threshold in other governors.

vii) ramp_down_step - Frequency delta when ramping down below the ideal frequency. Zero disables and will calculate ramp down according to load heuristic. When above the ideal frequency we always ramp down to the ideal freq.

viii) ramp_up_step - Frequency when ramping up above the ideal frequency. Zero disables and causes to always jump straight to max frequency. When below the ideal frequency we always ramp up to the ideal freq.

ix) sleep_wakeup_freq - The frequency to set when waking up from sleep. When sleep_ideal_freq=0 this will have no effect.

4. CONSERVATIVE

[ PARAMETERS ]

Quote:

Ondemand and conservative have some tunables in common, but with a few extras:

i) freq_step - this describes what percentage steps the cpu freq should be increased and decreased smoothly by. By default the cpu frequency will increase in 5% chunks of your maximum cpu frequency. You can change this value to anywhere between 0 and 100 where '0' will effectively lock your CPU at a speed regardless of its load whilst '100' will, in theory, make

it behave identically to the "ondemand" governor.

ii) down_threshold - same as the 'up_threshold' found for the "ondemand" 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.

5. INTERACTIVE

1. Generic Version

[ PARAMETERS ]

Quote:

i) hispeed_freq - An intermediate "hi speed" at which to initially ramp when CPU load hits the value specified in go_hispeed_load. If load stays high for the amount of time specified in above_hispeed_delay, then speed may be bumped higher. Default is the maximum speed allowed by the policy at governor initialization time.

ii) go_hispeed_load - The CPU load at which to ramp to hispeed_freq. Default is 99%.

iii) min_sample_time - The minimum amount of time to spend at the current frequency before ramping down. Default is 80000 uS.

iv) timer_rate - Sample rate for reevaluating CPU load when the CPU is not idle. A deferrable timer is used, such that the CPU will not be woken from idle to service this timer until something else needs to run. (The maximum time to allow deferring this timer when not running at

minimum speed is configurable via timer_slack.) Default is 20000 uS.

v) target_loads - CPU load values used to adjust speed to influence the current CPU load toward that value. In general, the lower the target load, the more often the governor will raise CPU speeds to bring load below the target. The format is a single target load, optionally followed by pairs of CPU speeds and CPU loads to target at or above those speeds. Colons can be used between the speeds and associated target loads for readability. For example:

85 1000000:90 1700000:99

targets CPU load 85% below speed 1GHz, 90% at or above 1GHz, until 1.7GHz and above, at which load 99% is targeted. If speeds are specified these must appear in ascending order. Higher target load values are typically specified for higher speeds, that is, target load values also usually appear in an ascending order. The default is target load 90% for all speeds.

vi) above_highspeed_delay - When speed is at or above hispeed_freq, wait for this long before raising speed in response to continued high load. The format is a single delay value, optionally followed by pairs of CPU speeds and the delay to use at or above those speeds. Colons can be used between the speeds and associated delays for readability. For example:

80000 1300000:200000 1500000:40000

uses delay 80000 uS until CPU speed 1.3 GHz, at which speed delay 200000 uS is used until speed 1.5 GHz, at which speed (and above) delay 40000 uS is used. If speeds are specified these must appear in ascending order. Default is 20000 uS.

vii) timer_slack - Maximum additional time to defer handling the governor sampling timer beyond timer_rate when running at speeds above the minimum. For platforms that consume additional power at idle when CPUs are running at speeds greater than minimum, this places an upper bound on how long the timer will be deferred prior to re-evaluating load and dropping speed. For example, if timer_rate is 20000uS and timer_slack is 10000uS then timers will be deferred for up to 30msec when not at lowest speed. A value of -1 means defer timers

indefinitely at all speeds. Default is 80000 uS.

viii) boost - If non-zero, immediately boost speed of all CPUs to at least hispeed_freq until zero is written to this attribute. If zero, allow CPU speeds to drop below hispeed_freq according to load as usual. Default is zero.

ix) boostpulse - On each write, immediately boost speed of all CPUs to hispeed_freq for at least the period of time specified by boostpulse_duration, after which speeds are allowed to drop below hispeed_freq according to load as usual.

x) boostpulse_duration - Length of time to hold CPU speed at hispeed_freq on a write to boostpulse, before allowing speed to drop according to load as usual. Default is 80000 uS.

2. Qualcomm Version/Intelliactive/IntelliMM

[ PARAMETERS ]

Quote:

Has some tunables in common with the generic version but with a few extras:

i) Sync_freq Feature - This feature will cause a CPU frequency to stay above a particular

value sync_freq) if certain conditions (determined by the two nodes

up_threshold_any_cpu_freq and up_threshold_any_cpu_load) are satisfied

ii) Sync_freq - Only when both of the above conditions are satisfied will the CPU not drop

below this frequency value. The higher this value, the higher the frequency to jump will

be when the above conditions are satisfied.

iii) Up_threshold_any_cpu_freq - If the maximum frequency across all the CPUs is higher

than or equal to this frequency value, do not let the current CPU fall below sync_freq.

The higher this value, the fewer the chances to go to sync_freq.

iv) Up_threshold_any_cpu_load - If the maximum load across all the CPUs is higher than

or equal to this load value, do not let the current CPU fall below sync_freq. The higher

this value, the fewer the chances to go to sync_freq.

v) up_threshold_multi_core - When the up_threshold_multi_core is crossed, the cpu is ramped up to optimal_freq.

vi) optimal_freq - When more than one CPU is online and if up_threshold_multi_core has exceeded, the governor will ramp up the CPU to this frequency. This value should be less than your device's max CPU frequency.

6. Wheatley

[ PARAMETERS ]

Quote:

target_residency - The minimum average residency in �s which is considered acceptable for a proper efficient usage of the C4 state. Default is 10000 = 10ms.

allowed_misses - The number sampling intervals in a row the average residency is allowed to be lower than target_residency before the governor reduces the frequency. This ensures that the governor is not too aggressive in scaling down the frequency and reduces it just because some background process was temporarily causing a larger number of wakeups. The default is 5.

7. Darkness/Nightmare

[ PARAMETERS ]

Quote:

cpu_up_rate - No of samples to evaluate load to scale CPU frequency up. Increasing this value will increase the time spent on a frequency.

cpu_down_rate - No of samples to evaluate load to scale CPU frequency down. Increasing this value will increase the time spent on a frequency

inc_cpu_load_at_min_freq - This threshold is used as up threshold while sampling at frequencies is less than freq_for_responsiveness.

inc_cpu_load - The frequency at which governor scales CPU up.

dec_cpu_load - The frequency at which governor scales CPU down.

Guide Part 1 Link: http://xdaforums.com/lenovo-a6000/how-to/cpu-governors-hotplug-drivers-gpu-t3528762

Guide Part 2 Link: http://xdaforums.com/lenovo-a6000/how-to/cpu-governors-hotplug-drivers-gpu-t3528766

Guide Part 4 Link : http://xdaforums.com/lenovo-a6000/how-to/cpu-governors-hotplug-drivers-gpu-t3528772

Please Press Thanks Button If It Helped . It Will Encourage Me to Work More For You Guys

THANK YOU:o:good: