[REF][ICS] Kernel Stuffs - How is ICS Kernel Different | updated may-28-2012 - Galaxy S II General

Hello again to all the people suffering from Obsessive Kernel Flashing Disorder. After i wrote an essay in this thread and bored the readers to death, here is a new thread as a reference to ICS kernel related stuffs. ICS is not a 100% different. But there are differences. Idea here is to understand "How is 3.0 ICS Kernels different from 2.6.35 GB Kernels". Additions, deletions, modifications?
Index:
Post 1: Understanding all the Kernel Tunables
Post 2: Exclusive Features - Dual Booting and BLN Breathing
Post 3: All New Governor - Pegasusq. Parameter Explanations, Sample Tweaks, How to Tweak
Post 4: Kmemhelper Binary Interface - Enjoy Virtual Kernel Hacking
Post 5: Miscellaneous FAQs on Kernel from Different Angles
To begin with we will understand some of the tunables in ICS kernels, taking Gokhanmoral's Siyah kernel as a reference. (Yes, the info here are also valid for other ICS kernels for SGS2). Universal Configurator Interface app ExTweaks has the following tunables with Siyah kernel.
Note: All the tunables explained below may not be available for your current kernel build. Devs tend to experiment by removing some interfaces and adding them back later.
TAB 1 - CPU: Task Scheduler, Hotplugging, Smooth Scaling, Idle States
1) CFS Tweaks:
CFS is the default task scheduler. A task/CPU scheduler does process scheduling, ie manages how the threads, processes or data flows are given access to system resources. (I/O scheduling is different. I/O scheduler schedules I/O requests) CFS uses a binary search tree instead of run-queue method to maintain a timeline of future task execution. Note: Results of task scheduler tuning are experienced only during multi tasking, not during benchmarks.
a) GENTLE FAIR SLEEPERS
Significance: Android UI Interactivity.
Sleeper Fairness is a concept used by CFS which treat sleeping/waiting tasks as if they were in a run queue. This implies tasks which spend most of the time waiting for an user input and such will get a fair share of CPU when they need it. Disabling Gentle Fair Sleepers could improve UI responsiveness.
Tweaking Via Script:
#disable
echo "NO_GENTLE_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features
#enable
echo "GENTLE_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features
b) ARCH POWER
Significance: ARM Topology Awareness.
Arch Power patch causes arch dependent power functions to be used instead of generic high resolution timer ticks and double ticks.
Tweaking Via Script:
#disable
echo "NO_ARCH_POWER" > /sys/kernel/debug/sched_features
#enable
echo "ARCH_POWER" > /sys/kernel/debug/sched_features
2) Hotplug Mode:
Significance: ON/OFF behavior of CPU cores.
Hotplugging as we know dynamically activates second CPU core ON on load conditions and turns second core OFF on low load conditions. Best practice is to use hotplugging instead of single/dual core modes and tweak settings in such a way that until about 800 mhz, only first core is active. This is energy efficient since voltage increase is steep for frequencies above 800mhz. So static power consumption increases sharply and it's better to have two cores handling tasks from here on. According to a test, having only one core online roughly saves about 55% power compared to two cores online. But it's not worth using single core for all frequencies since the device is capable of more.
Sample Value: CPU Hotplug
Tweaking Via Script:
#HOTPLUG
echo "on" > /sys/devices/virtual/misc/second_core/hotplug_on
echo "on" > /sys/devices/virtual/misc/second_core/second_core_on
#SINGLE CORE:
echo "off" > /sys/devices/virtual/misc/second_core/hotplug_on
echo "off" > /sys/devices/virtual/misc/second_core/second_core_on
#DUAL CORE:
echo "off" > /sys/devices/virtual/misc/second_core/hotplug_on
echo "on" > /sys/devices/virtual/misc/second_core/second_core_on
3) load_h0, load_l1:
Significance: Thresholds to ON/OFF second CPU core
Load-High-0 and Load-Low-1 are UP/DOWN thresholds to turn ON and turn OFF second core. When load on first core is greater than loadh0, second core comes online. When average load on both cores is less than loadl1, second core goes offline. Do not overload first core before turning second core on aka do not use high thresholds. See Q&A at the bottom of the post
Sample Values: Less Aggressive: load_h0 50, load_l1 20. More Aggressive: load_ho 30 load_l1 20.
ICS hotplugging logic is different from GB hotplugging. To get the same responsiveness as in gingerbread, use more aggressive(reduced) load_h0 thresholds.
Valid Values: 0 to 100%
Tweaking Via Script:
echo "30" > /sys/module/stand_hotplug/parameters/load_h0
echo "20" > /sys/module/stand_hotplug/parameters/load_l1
4) min_rq, load_rq:
Significance: Enhance hotplugging via CPU Run Queue and Process Priorities
ICS has multiple hotplugging concepts. What's normally used is Standalone Hotplug. We also have the one like GB's (remember loadh, loadh_scroff, loadl, etc). min_rq - Minimum Run Queue and load_rq Load on Run Queue are two parameters to increase multi thread awareness of ICS hotplugging. With these parameters we achieve the goal of turning of second core if fewer task threads are running - even if load is high.
If no of threads running on a Core is less than min_rq and load of that Core is less than load_rq, second core is turned off. Note that the load threshold considered here is for only one core (unlike load_l1 which takes average load on cores to make turning-off-second-core decision).
Example: Let min_rq=2 and load_rq=40%. Suppose both cores are online. Average load on cores has not dropped below load_l1 so it's still not time to turn off second core. But say only one thread is running on second core and load on that core is 30%. Then second core will be turned off.
Sample Values: min_rq 2, load_rq 20%
Valid Values: min_rq: 0, 1 and 2. load_rq: 0 to 100%
Tweaking Via Script:
echo "2" > /sys/module/stand_hotplug/parameters/min_rq
echo "20" > /sys/module/stand_hotplug/parameters/load_rq
5) rate:
Significance: Hotplug Sampling Interval
Every rate jiffies, load is sampled and if found to be more than loadh0, second core is turned ON. One jiffy is the time taken to complete one tick of the system timer. Sgs2 timer frequency is 200hz. So the value divided by 200 gives the equivalent seconds or in other words, one jiffy = 5 milliseconds in GS2 terms.
Sample Values: rate 100.
Valid Values: 50 to 1000 jiffies, in terms of 50s.
Tweaking Via Script:
echo "100" > /sys/module/stand_hotplug/parameters/rate
6) freq_min:
Significance: Cut-off frequency for second core to turn ON
'Threshold' frequency for second core to turn ON during hotplugging. If current frequency <= freq_min, second core will not turn on even if the load has crossed loadh0. CPU runs efficiently if only single core is used until about 800 mhz and both the cores after 800.
Sample Value: freq_min 800000
Valid Values: All the values in freq_table
Tweaking Via Script:
echo "800000" > /sys/module/stand_hotplug/parameters/freq_min
7) CPU Idle States:
Significance: Power saving CPU idle modes that are 'encountered' between screen-off and deep-sleep.
Unlike 8 idle states supported by Nexus OMAP4, GS2 Exynos supports only 3: IDLE, AFTR, LPA.
IDLE - Clock is gated but power on CPU core remains (static power consumption still active)
AFTR - Clock is gated, power on CPU cores removed and L2 cache power remains. Static power consumption mostly eliminated.
LPA - Cache power removed.
AFTR or LPA cannot be entered if second core is active.
Sample Values: Idle Mode 3 (AFTR+LPA), to save battery.
Valid Values: 0, 1, 2, 3
Tweaking Via Script:
#AFTR+LPA
echo "3" > /sys/module/cpuidle_exynos4/parameters/enable_mask
#IDLE+LPA
echo "2" > /sys/module/cpuidle_exynos4/parameters/enable_mask
#AFTR only
echo "1" > /sys/module/cpuidle_exynos4/parameters/enable_mask
IDLE only
echo "0" > /sys/module/cpuidle_exynos4/parameters/enable_mask
8) Sched_mc:
Significance: Increases multi-core awareness!?
Sched_mc aims to schedule tasks between multiple cores in the CPU. Sched_mc can be a) OFF (value 0), b) load balance (value 2) the cores by keeping the load even between them or c) power-save balance (value 1) by loading first core until it's 100% loaded. Hotplugging does load balancing already by taking care of thresholds, run queues, process priorities, cut-off frequency, etc. So there's no use of sched_mc = 1. Powersave balancing which overloads first core will increase the time to relieve first core (as compared to same task balanced between both the cores). This will cause delay to hit deep-idle states, since only first core can enter AFTR/LPA states.
Disable sched_mc. There could be only one situation where load balancing or weird-overloading of first core can be useful - when we use dual core mode. Sched_mc is valid only when both cores are online. If someone uses dual-core mode sched_mc is worth a try to handle task-loads across cores.
Sample Values: sched_mc 0
Valid Values: 0, 1, 2
Tweaking Via Script:
#disable sched_mc
echo "0" > /sys/devices/system/cpu/sched_mc_power_savings
#enable first core overloading
echo "1" > /sys/devices/system/cpu/sched_mc_power_savings
#load balancing
echo "2" > /sys/devices/system/cpu/sched_mc_power_saving
9) smooth_target, smooth_offset, smooth_step:
Significance: CPU Throttling
These params helps in 1) Throttling CPU at higher temperatures 2) Control Ondemand based governors' urge to jump to maximum frequency too often by jumping the CPU to an intermediate frequency first. If we're not interested in either of them, leave it as 0 0 0. NOTE: Smooth scaling is enabled only for Ondemand and Pegasuq governors.
Sample Values: smooth_target 2, smooth_offset 2, smooth_step 2
Valid Values: 0, 1, 2, 3, 4 (for all three params)
Tweaking Via Script:
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/smooth_target
echo "2" > /sys/devices/system/cpu/cpu0/cpufreq/smooth_offset
echo "2" > /sys/devices/system/cpu/cpu0/cpufreq/smooth_step
10) smooth_level:
Significance: Intermediate Step Before Scaling Max Freq
smooth_level is a standalone parameter to control smooth scaling. When ondemand/pegasusq governors instruct CPU driver to scale CPU up to max frequency, CPU driver first scales CPU to smooth_level then on next sampling to highest frequency. Only goal here is to save some battery.
Sample Values: smooth_level 800mhz
Valid Values: Level number of any frequency between your scaling min frequency and scaling max frequency.
Tweaking Via Script:
#Level 8 in 18step freq table is 800mhz
echo "8" > /sys/devices/system/cpu/cpu0/cpufreq/smooth_level
11) CPU Step Counts:
Significance: Set of Available Frequencies aka 'Tightness of Freq Table'
Some are O.K with Samsung defaults of 5 frequency steps, some users need a 1400 on top, some needs a 1600 too. Some would like to set intermediate frequencies in between. To satisfy everyone, we have configurable CPU Frequency Table to echo custom frequency steps. Possible step counts (selectable from ExTweaks) are
5 - Samsung default: Good old 200-500-800-1000-1200.
6 - Sammy default plus 1400 mhz: 200-500-800-1000-1200-1400
7 - 6 Step plus 1500: 200-500-800-1000-1200-1400-1500
8 - 6 Step plus 100 in the 'bottom' and 1600 on 'top': 100-200-500-800-1000-1200-1400-1600
9 - 8 Step plus 1500: 100-200-500-800-1000-1200-1400-1500-1600
18 - All possible 18 steps.
Note: Any number of steps between 3 and 18 is possible (use script). Only condition is 500,800 and 1000 should be present in the list.
Sample Values: Select any step count you like
Valid Values: 1600, 1500, 1400, 1300, 1200, 1100, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 50, 25. (In Mhz. Note that you echo to the table as Khz)
Tweaking Via Script:
echo "1600 1400 1200 1000 800 500 200 100" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
12) Scaling Min & Max Frequencies:
Significance: Frequency Range to be Used from Frequency Table
Any governor will scale CPU up and down between scaling_min_frequency and scaling_max_frequency. We change value of these two to UC/OC
Sample Values: scaling_min_frequency 200 and scaling_max_frequency 1200
Valid Values: Any frequencies from frequency table. Only condition is scaling_max_freq should be greater than scaling_min_frequency.
Tweaking Via Script:
echo 200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
TAB 2 - GPU: GPU behavior. This matters more than CPU UV w.r.t Screen-On power savings!
1) GPU Frequency Steps:
Significance: Configurable GPU Frequency Steps
There are plenty of frequencies supported by the MALI400. Valid frequencies are 800 divided by an integer not greater than 20. I would recommend using energetically efficient GPU freqs. Note that any Nth step can not be less than (N-1)th step.
Sample Values: 160 200 267. If you want more frames, use 200 267 400.
Valid Values: 400 267 200 160 133 114 100 89 80 73 67 62 57 53 50 47 44 42 40
Tweaking Via Script:
echo "160 200 267" > /sys/class/misc/gpu_clock_control/gpu_control
2) GPU Voltages:
Significance: Set enough voltage to support your underclocked or overclocked GPU frequency steps.
GPU Undervolting (if not taken care of) has some worse side effects compared to CPU UV. Your game and navigation app will crash. I'd recommend to use stock voltages. Or just a -50mV UV for each step.
Sample Values: 950 1000 1050
Valid Values: 800mV to 1200 mV at 50mV steps.
Tweaking Via Script:
echo "900000 950000 1000000" > /sys/class/misc/gpu_voltage_control/gpu_control
3) GPU UP and DOWN Thresholds:
Significance: When should GPU scale up and down across GPU frequency steps.
The four thresholds are threshold to switch to second step, switch back to first step, switch to third step, switch back to second step. We do not want GPU to scale up immediately after scaling down to a frequency. This implies the thresholds are overlapping load-evaluations. Use up-thresholds of the range 80-90. To calculate down-thresholds in such a way that overlapping is prevented, for a set of two freqs, find out what percentage of higher frequency is lower frequency, and reduce 5-10 % from the resultant value. Ex: for 160 to 200, 160 is 80% of 200. Reducing 10% gives 70%.
(If you like the 'good old' two frequency step, set Threshold-2-UP to 100 so that only First two steps are used and third step will never be active)
Sample Values: 85 70 85 65 (For GPU steps 160 200 267). OR 85 65 85 55 (For GPU steps 200 267 400).
Valid Values: 0 to 100%
Tweaking Via Script:
echo "85% 70% 85% 65%" > /sys/class/misc/gpu_clock_control/gpu_control
4) GPU Stay Counts:
Significance: Delaying next sampling/stay at a GPU step for longer time.
Staycount is the no of cycles to stay at each GPU step. It is recommended to leave it as default 1 1 1. A check in dvfs part make sure that changing frequencies happens only after staycount expires - regardless of load crossing thresholds.
For example : Staycount of 1 0 2 for 160 200 267 steps implies => i) A transition from 160 to 200 happens only a after a minimum of 1 second even if load on 160 exceeded the threshold before 1 second expired. ii) A transition from 200 to 267 or 160 can happen anytime load crosses threshold. iii) A transition from 200 to 267 happens only a after a minimum of 2 seconds even if load on 160 exceeded the threshold before 2 seconds expired.
Sample Values: 1 1 1
Valid Values: 0, 1, 2, 3, 4, 5 Seconds
Tweaking Via Script:
echo "1 1 1" > /sys/class/misc/gpu_clock_control/gpu_staycount
TAB 3 - SCREEN: Touch sensitivity, Brightness curve
1) Touch Move Sensitivity:
Significance: Improving touch sensitivity
Supported values are between 0 and 20. Lower value is more responsive. But setting it too low will cause swipes to be registered as clicks.
Sample Value: 7 pixel
Valid Values: 0 to 20 pixels
Tweaking Via Script:
echo "7" > /sys/devices/platform/s3c2440-i2c.3/i2c-3/3-004a/mov_hysti
#Another touch sensitivity parameter is tsp_threshold which can take the values between 40 and 80 at steps of 10. Lower value is more responsive.
echo "50" > /sys/devices/virtual/sec/sec_touchscreen/tsp_threshold
2) min_bl, min_gamma, max_gamma:
Significance: Brightness Response Curve.
If you don't want lowest brightness to be very low, use 30 1 20 which are stock values. We will have lowest brightness or zero gamma for brightness level read from sensor < min_bl (30 here). Brightness levels above that is linearly mapped to [min_gamma:max_gamma] ( [1:20] here). To decrease minimum brightness level (some users find the lowest brightness level too bright in dark conditions), increase min_bl.
Sample Values: 30 1 20 (for stock experience) OR 50 0 15 (for low lowest brightness level and low highest brightness levels)
Valid Values: min_bl 0 to 150, min_gamma 0 to 20, max_gamma 0 to 20
Tweaking Via Script:
echo "30" > /sys/class/misc/brightness_curve/min_bl
echo "1" > /sys/class/misc/brightness_curve/min_gamma
echo "20" > /sys/class/misc/brightness_curve/max_gamma
3) Gamma Shift
Significance: Gamma Correction
Gamma in the simplest form is a non linear operation to code and decode luminance of display systems. If display is not properly gamma encoded, human eye will not be able to differentiate highlights and details. Keep in mind that brightness perception of human eye is non-linear (ie, relationship between perceived brightness and luminance is non linear). Better perception is achieved at lower luminance level.
Use negative values for darker image system and positive values for brighter.
Sample Values: 0 (stock) or -15 (darker)
Valid Values: -50 to +50 (at steps of 1)
Tweaking Via Script:
echo "0" > /sys/class/lcd/panel/user_gamma_adjust
4) Vibration Intensity
Significance: Vibration Intensity for Notifications
You can change the intensity of vibration for calls, notifications, htpic feedback, etc. Change is most likely noticable only in aosp/aokp roms.
Sample Values: 6 (stock) or 2 (low intensity)
Valid Values: 0 to 6 pixels(at steps of 1)
Tweaking Via Script:
echo "6" > /sys/devices/platform/tspdrv/vibrator_level
TAB 4 - BLN: Backlight Notification and LED Timeout Settings
1) BLN
Significance: Notification for Missed Calls, SMSes, Emails, etc
GS2 doesn't have led notification built in. Instead the capacitive touch keys were hacked to lit up when some notification arrives.
Tweaking Via Script:
#ON
echo "1" > /sys/class/misc/notification/notification_enabled
#OFF
echo "0" > /sys/class/misc/notification/notification_enabled
2) Notification Timeout
Significance: Timeout for an Active BLN Notification
Timeout can be anything from a minute. Set it according to your taste and need.
Sample Values: 10 minutes
Valid Values: 1 minute to 2 hours to anything
Tweaking Via Script:
#In milli secs. Minutes*60*1000. Ex: For a 15 minute timeout set 15*60*1000 = 900000
echo "600000" > /sys/class/misc/notification/notification_timeout
3) BLN Effect
Significance: Pattern of Notification - breathe, static lights or blink
Breathing effect is achieved by supplying a lower to highest voltage at a particular step to backlight with a small pause/sleep in between. This is breathe Up. To breathe Down, voltage is supplied in the reverse order with a pause in between.
Tweaking Via Script:
#enable steady/static lights
echo "0" > /sys/class/misc/notification/breathing
#enable breathing/blinking
echo "1" > /sys/class/misc/notification/breathing
#breathing config - Min Voltage, Max Voltage (in mV), period/pause in between voltage changes (millisec), voltage step (mV)
echo "2500 3300 70 50" > /sys/class/misc/notification/breathing_steps
echo "3300 2500 70 50" > /sys/class/misc/notification/breathing_steps
#blinking config - set same voltages as min and max. It blinks
echo "2500 2500 500 100" > /sys/class/misc/notification/breathing_steps
echo "3300 3300 500 100" > /sys/class/misc/notification/breathing_steps
4) LED Timeout
Significance: Timeout for Backlights to stay On after touching buttons/screen
In Samsung roms, system settings can be used to achieve the same. Leave extweaks settings disabled for sammy roms. Since aosp roms do not have led timeout settings by default, use extweaks/script. If you want it always enabled, use settings in the rom.
Tweaking Via Script:
#backlights always off
echo "0" > /sys/class/misc/notification/led_timeout
#backlights turns off after a timeout after a touch. Unit - millisec
echo "1500" > /sys/class/misc/notification/led_timeout
5) LED Fadeout
Significance: Fadeout effect instead of LEDs normally turning off after touching buttons/screen.
Lights fading out can be an eye candy.
Tweaking Via Script:
echo "1" > /sys/class/misc/notification/led_fadeout
6) LED on Touch
Significance: Turn ON LEDs on Touching Screen
This is samsung default behavior but aosp/aokp roms miss this feature. If you like capacitive buttons to lit up on screen touch (along with buttons touch), enable this option.
Tweaking Via Script:
echo "1" > /sys/class/misc/notification/led_on_touch
7) Test BLN
Significance: Test BLN to see if everything works as you expected
Testing can be achieved by a script too like given below.
Tweaking Via Script:
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ "$SLEEPING" = "sleeping" ]; then
sleep 1
echo "1" > /sys/class/misc/notification/breathing_steps
8) LED Voltage Levels
Significance: Brightness of Touchkey Light
Minimum of 2550mV is required to lit up touchkey. Default is 3000mV. Max is 3300mV.
Tweaking Via Script:
echo "3000" > /sys/devices/virtual/sec/sec_touchkey/touchkey_brightness
TAB 5 - MISC: Governor, Scheduler, Miscellaneous Tweaks
1) Backup EFS: Backup your precious EFS partition to use in the future to recover a lost IMEI.
2) Android Logger: Enable/Disable Logging. Leave it enabled. Would be helpful to produce logcat and last_kmesg when you have a crash or freeze.
3) Default Ondemand Suspend Freq: Max frequency that will be used during screen-off state if Ondemand is the active governor. 500000 (500 mhz) is the most sensible value.
4) Default CPU Governor: Use whichever you like. Ondemand is good enough.
5) Default I/O Scheduler: Use whichever you like. I use sio/bfq.
6) Charge Current: Since it was proved that i9100 Li-ion battery charge current can only be either of 450mA and 650mA, leave it at AC:650, MISC:450,USB:450 OR AC:650 MISC:650 USB:450
Tweaking Via Script:
echo "650 650 450" > /sys/devices/virtual/misc/charge_current/charge_current
7) Reset Fuel Gauge Chip: After a low-battery reboot if the battery shows very low and incorrect percentages since true battery capacity failed to accurately synchronize with the fuel gauge, press the button and wait for sometime. An alternative is to charge full->discharge full->charge full.
8) Remove Root: Some apps detects root and refuse to work if found. In such cases, or if some apps are freezing in a while, remove root and re-install root. Pressing the button will remove Superuser.apk and SU binary.
9) Install Root: Tries to install root after a removal. Copies Superuser.apk and SU binary. If this fails, check 'Auto-Install Root' and reboot.
Randomly Asked Questions:
Q. "Why don't you just give a set of battery friendly or performance friendly tweaks to be used with ExTweaks app instead of lengthy sentences and crap?"
A. Three reasons: 1) Every device is different. 2) What i think are battery friendly/performance friendly settings may not please you. 3) It's useless to copy a setting without understanding what it does.
So i'm trying to give an almost accurate picture of effect of changing values of tweakable parameters. Then you will know what value and settings is best whether you're a battery-freak, performance-freak, 'I want it to be balanced'-freak. You will never have to ask in a thread "What is the best settings for this kernel".
Q. "What are the power domains i should be aware of so that i can think this way: Tweak settings related to each domain to make the most out of my kernel"
A. CPU cores (and L2 cache), GPU, Memory Interface and Audio/Video IP blocks
Q. "How about a short brief algorithm which explains working of hotplugging where i can see how are each parameters used."
A. Note the parameters with red font color. Those are the tweakable hotplug parameters mentioned above.
FUNCTION: standalone_hotplug()
Takes three parameters: load, min_rq, and minimum_cpu_run_queue_length
WORKING:
if ( both cores online AND [average_load < load_l1 OR current_cpu_frequency <= freq_min] ) RETURN HOTPLUG_OUT
else if ( only first core online AND average_load > load_h0 AND current_frequency > freq_min) RETURN HOTPLUG_IN
else if (both cores online AND min_rq < 2 AND load on the core corresponding to minimum_cpu_run_queue_length < load_rq) RETURN HOTPLUG_OUT;
SAMPLING PART:
Retrieve the value returned by standalone_hotplug by passing current load, min_rq and calculated minimum_cpu_run_queue_length
if (HOTPLUG_IN was returned AND second core is OFF)
Turn ON second CPU
Next sampling at 4 times the value of rate
else if (HOTPLUG_OUT was returned AND second core is ON)
Turn OFF second CPU
Next sampling at the value of rate

Exclusive Features
We will explore some of the exclusive features in ICS kernels, ofcourse brought in by XDA devs and not Samsung themselves.
Any feature is best explained through answers for different kind of questions. Atleast, that's what i believe
We have dual-booting and bln breathing to start with. Features are originally brought in by gokhanmoral and is available in a few kernels like Siyah as of now.
1. Dual Booting
1) "So what's dual booting?"
A. Option to boot into either of two ICS roms - aosp or sammy. Immediately after the boot logo, there is a 3 seconds time-out where you can boot into secondary rom by pressing the home key/volume down key. To boot into primary rom, wait for 3 seconds time-out to complete. If you don't like to wait - touch the screen, or press power key or press volume up key.
2) "What's the basic architecture behind dual booting?"
A. Any rom will have /system, /data, /cache partitions and requires a kernel to boot. Primary rom has all these partitions on the same location and partitions as if you were single-booting. ie, /dev/block/mmcblk0p09 for /system and rootfs for /data and /cache. Secondary rom uses a hidden partition (/dev/block/mmcblk0p12) for /system and sdcard to store /data and /cache partitions. They're stored in /sdcard/.secondrom directory as mountable ext4 block device images (data.img and cache.img).
Kernel partition is shared, so same kernel boots both the roms. If you switch from Siyah to a different kernel, dual booting will not be available even though there's a clone of secondary rom. Internal sdcard, external plastic sdcard, /efs, /emmc, other kernel related virtual filesystem directories, etc are shared among roms.
3) "I have just one rom now. How do i setup one more rom to dual boot?"
A.
-To use current rom as primary: Assuming the other rom is downloaded and copied to phone memory
Easy Method
i) Flash latest Siyah that supports dual boot.
ii) Wipe data and cache of second rom using format /secondrom_cache and format /secondrom_data options under dual boot menu in recovery.
iii) Flash rom zip as second rom directly using "Install zip to 2ndROM from internal SD" or "Install zip to 2ndROM from external SD" under dual-boot options in Recovery.
Old/Alternative Method if Easy Method fails
i) Flash latest Siyah that supports dual boot.
ii) Nandroid backup your existing rom.
iii) Full wipe, install the rom you need to dual boot into.
iv) Boot into that rom, perform initial setups, flash whatever zip you need to flash on that rom - gapps, themes, mods, etc.
v) Flash latest Siyah on this rom.
vi) Boot into recovery, under dual-boot options, select "Clone Primary ROM to Secondary". Be patient and wait about 6-7 minutes. Now the new rom is secondary rom.
vii) Within recovery, restore nandroid backup. Now, the existing rom becomes primary.
viii) Just to be sure, flash latest Siyah again.
-To use current rom as secondary: Assuming the other rom is downloaded and copied to phone memory
Easy Method
i) Flash latest Siyah that supports dual boot.
ii) Boot into recovery, under dual-boot options, select "Clone Primary ROM to Secondary". Now your existing rom becomes secondary.
iii) Full wipe and install the Rom you want to use as primary.
iv) Flash latest Siyah just to be sure.
Alternative Method
i) Flash latest Siyah that supports dual boot.
ii) Wipe data and cache of second rom using format /secondrom_cache and format /secondrom_data options under dual boot menu in recovery.
iii) Flash rom zip as second rom directly using "Install zip to 2ndROM from internal SD" or "Install zip to 2ndROM from external SD" under dual-boot options in Recovery.
iv) Select "Swap 1st Rom and 2nd Rom" under dual-boot options in recovery.
Now you have two roms. Press home key to boot into second rom when time-out is displayed.
4) "How much time was it to clone a rom?"
A. There's /system, /data/ and /cache to clone. 2 GB data + 103mb cache + 513 mb system = 2.6 gb
Shell prompt read speed = 7mb per second.
Total Time = 2.6*(1024/7) = 380 secs = 6/7 minutes.
5) "If i reboot to recovery from power-off state using 3 button method, to which rom's recovery it's booted into?"
A. Unified kernel, same recovery. And remember - flashing zips to second rom is not possible as of now.
6) "Any solution to flashing zips to secondary rom?"
A.
Yes. Use Install zip to 2ndROM from internal SD" or "Install zip to 2ndROM from external SD" under dual-boot options in Recovery.
Alternative 1:
If you know what the updater script in the zip is doing, you can do that manually using Root Explorer (replacing/copy files, setting permissions, etc).
Alternative2:
i) Swap 1st Rom and 2nd Rom using Dual-boot options in recovery. Now your 2nd rom becomes primary for time being.
ii) Install zips like normal.
ii) Swap again.
7) "Should i have same versions of kernels on both roms? If not, from which rom should i flash the kernel"
A. Flash kernel from any rom (if cwm app/darkyota is used). Both uses the same kernel partition anyway.
8) "Will i get a prompt to dual-boot if i'm not using dual boot, as in i haven't cloned any rom to use as secondary?"
A. NO
9) "I don't like waiting for 3 seconds to boot into primary rom."
A. Touch the screen/press volume up key immediately upon prompt.
10) "How to undo dual booting?"
A. Use "Remove 2ndRom" from dual-boot options in recovery.
11) "How to remove secondary rom if "Remove 2ndRom" in touch recovery fails for some reason?"
A. Format 2nrom /system partition from dualboot options in recovery, remove data.img and cache.img under /sdcard/.secondrom directory manually by booting into primary rom. Also delete /secondrom directory.
12) "So if at all i format /sdcard, my second rom is gone?"
A. Yes
13) "Is the size of /system partition of secondary rom re-sizable from user space?"
A. NO
14) "Can i have both aosp roms/both samsung roms/first aosp, second samsung/first samsung,second aosp?"
A. Yes
15) "Can i have one GB rom and second ICS rom?"
A. No
16) "Why?"
A. Kernel partition is shared between roms. Dual boot functionality is implemented in ICS kernel. ICS kernel can run only ICS roms.
17) "Can i have different kernels for the two roms?"
A. NO. Kernel partition is shared.
18) "USB mass storage works?"
A. Yes. Both cards will be mounted for primary and secondary roms. MTP works too.
19) "If i had the same /data partition shared between roms, i could use same apps on both roms."
A. Data partition can not be shared as they're incompatible between roms. (Sometimes dev asks you to perform full wipe even if you're switching between versions of the same rom right). Even if they were shared, separate dalvik caches has to be used and hence every boot will take a long time to rebuild dalvik.
20) "How do i swap primary and secondary roms?"
A.
Easy Way:
In recovery, select "Swap 1stRom and 2ndRom". It may take upto 20 minutes. Be patient and watch the progress bar.
Difficult way: If the "swap" in recovery fails,
i) Select "Backup secondary rom" under dual boot options.
ii) Under original Backup and Restore option, select "Backup" to nandroid backup your primary rom.
iii) Under dual boot options, "Restore as secondary rom" or "Restore as secondary rom from internal sd" and select the nandroid backup of what was actually your primary rom.
iv) Under original Backup and Restore option, select "Restore" to restore the rom you backed up as secondary.
21) "How to upgrade primary rom?"
A. As usual, goto recovery, wipe whatever you need to wipe and install the new version. Remember to flash latest Siyah after upgrading if the Rom comes with a different kernel.
22) "How to upgrade secondary rom?"
A. Use "Install zip to 2ndROM from internal SD" or "Install zip to 2ndROM from external SD" under dual-boot options in Recovery. to flash the Rom zip. If any wipe is required, use format /secondrom_cache, format /secondrom_dalivkcache, format /secondrom_data and format /secondrom_system under Mounts & Storage in recovery.
Alternative 1, if the above fails:
Temporarily convert secondary rom to primary (by swapping them in recovery), flash rom zip revert primary back to secondary by swapping again. Remember to flash latest Siyah after upgrading. (This is just to be sure. Flashing zip to second rom does not change kernel)
23) "How to replace secondary rom with another?"
A.
Easy Way:
i) Wipe second rom partitions using format /secondrom_cache, format /secondrom_dalivkcache, format /secondrom_data and format /secondrom_system.
ii) Install Rom zip using Install Zip to 2ndROM from internal SD or external SD from dual-boot options in recovery.
Difficult Way:
Perform the steps to setup dual boot as if you had only one rom which is going to be used as primary rom.
24) "How to replace primary rom with another?"
A. Normal procedure - wipe, install from recovery.
25) "Are init.d scripts and extweaks profiles shared across the roms so that i can make changes by booting into any rom and the other rom automatically inherits the settings?"
A. NO. Roms have differet /system partitions so different init.d directories. Roms uses different /data partitions so different extweaks settings since extweaks profiles are stored under /data/.siyah. Configure both separately. Initramfs scripts are shared anyway because Roms use the same kernel.
26) "Can i use titanium to backup and restore apps on both roms?"
A. Yes. With the default settings of titanium backup, it uses /sdcard/TitaniumBackup directoryto backup apps. Assume you have the same app installed in both roms and you backed up the app from both roms. Then when you restore app+data, the last backup is restored. (regardless of from which rom was it backed up last. Because the app database is overwritten for each backup). If you want to maintain exclusiveness between apps in the two roms, use a different backup directory in second rom. Reason for exclusivity could be - you need different settings for same app in the roms OR you have reached level 2 of a game in rom1 and level 6 in rom2 and you need to maintain that, etc.
27) "What're the Dual Boot options available in touch recovery?"
A.
i) View Current Status
Displays secondary rom info if found.
ii) Clone 1stRom to 2ndRom
First time, you will have only one rom. You may clone it as secondary rom (so that another rom can be used as primary). Note that what was Primary rom will remain as Primary after this. In short - you will copy of same rom and 1st and 2nd.
iii) Clone 2ndRom to 1stRom
Whatever has been cloned as second Rom is cloned to first rom. Note that what was Second rom will remain as Second after this. In short - you will copy of same rom and 1st and 2nd.
iv) Remove 2ndRom
Remove second Rom by Deleting /system, /data and /cache partitions of second rom. You will have normal booting.
v) Swap 1stROM and 2ndROM
Swaps primary and secondary roms by exclusively overwriting /system /data and /cache of both roms. This is a time consuming process. Be patient.
vi) Backup 2ndROM
Nandroid backup secondary rom to external sd.
vii) Restore as secondary rom
Restore any nandroid backup as secondary rom from external sd.
viii) Backup 2ndROM to internal SD
Nandroid backup secondary rom to internal sd.
ix) Restore as 2ndROM from internal sd
Restore any nandroid backup as secondary rom from internal sd.
x) init second rom data
Initialize /data parition of secondary rom to resize the partition to make it bigger in case you run out of space for apps. Init also wipes all the data in /data partition. So your existing apps in secondary rom will be gone.
xi) wipe second rom davik cache, xii) fix permissions in second rom - self explanatory
xiii) Install Zip to 2ndROM from Internal SD xiv) Install Zip to 2ndROM from External SD- self explanatory
xv) Wipe options for Second ROM can be found under Mounts and Storage - / format /secondrom_cache, format /secondrom_dalivkcache, format /secondrom_data and format /secondrom_system.
Mounting partition options for 2nd ROM can also be found there.
28) Why is "cloning 1stROM to 2ndROM" slower than "cloning 2ndROM to 1stROM"?
A. While cloning primary to secondary, it writes data.img and cache.img to internal sd card. While cloning secondary to primary, the images are written to device memory or rootfs. This is faster than writing to a mounted storage.
29) "Why can't internal SD be mounted with secondary rom whether it's sammy or aosp?"
A. It works now.
/data and /cache partitions of secondary rom resides in the internal sd. (/sdcard/.secondrom). So internal sd can not be unmounted to mount it to the PC. MTP works for internal SD too. Even though slower, that's the only option we got.
30) "After setting up Second Rom, i don't see a prompt to boot into second rom".
A. Try wiping Second Rom Cache and Dalvik.
31. "Before wiping 2ndROM data/cache, i had some free space on internal sdcard. During wipe it failed and that space has dissipated. Even after a successful wipe, the space is still lost."
A. Try (1). If it fails, try (2)
1) Delete files in /sdcard/.secondrom directory.
2) The space was occupied by lost.dir in /sdcard. Delete contents in that directory and you have the space back now.
32. "What's happening when i wipe /data and /cache of 2ndROM during the first time setup of dual boot?"
A. Two empty mountable EXT4 images - data.img and cache.img are created in /sdcard/.secondrom. While flashing zips to second rom, /data and /cache of second rom needs to be mounted in respective mmcblk. This empty .img files helps zip flashing without having the trouble to create them first.
33. "Will flashing a rom zip to second rom (when i already have dual booting) change kernel? I may lose dual boot if so."
A. NO. Flashing kernel is prevented for second rom if the zip contains a kernel.
34. "I lost dual booting after i flashed primary rom via odin". I flashed kernel again. I could see files in /sdcard/.secondrom. But no dual boot. Help"
A. Some carrier branded firmwares and such may wipe and push some apks and csc stuffs to the hidden partition used as /system of second rom. About 100 MB is used i think. After first reboot, it's never used again, but now you have lost /system of second rom even though data and cache are intact in SD.
Copy data.img and cache.img of secondrom from /sdcard/.secondrom to PC. Then modify your zip installer of your second rom to install only /system of second rom. (Edit updater-script in the zip to comment out lines that write to /data).
Now full wipe second rom /data and /cache. Format second rom /system. Flash the modified zip to second rom. Copy back and replace data.img and cache.img from your PC. Second rom should be intact now.
2. BLN Breathing
Q. What's bln breathing?
A: With BLN apps like bln control pro, we could set lights to be statically lit or blink when a notification arrives. A third effect could be achieved - breathing. Lights can follow a pattern to Fade In and Fade Out. Infinite possibilities exist for pattern since the tunables that control breathing can be set from the user space.
Q. How is breathing achieved?
A: A series of incidents using three principles: Vary LED voltage level from a Min to Max and then Max to Min, Pause between voltage changes, Supply a different voltage as next voltage defined by a voltage step.
Q. Make it more clear?
A. Let's take an example.
echo "2500 3300 70 50" > /sys/class/misc/notification/breathing_steps
echo "3300 2500 70 50" > /sys/class/misc/notification/breathing_steps
First two parameters defines star and end voltages/ min and max voltage (unit millivolts). Third parameter is the period or pause (in milliseconds) between voltage changes. Last parameter is the voltage step in millivolts.
As you notice, there's on more echo statement which reverse the voltage limits. This is because breathing is asymmetric. So commands for Fade IN (light on) and Fade OUT (light off) need to be written separately.
Some points to note:
-2550 is the minimum voltage to turn LEDs On.
-3300 is the maximum voltage that's supported by regulator.
-2500 is the minimum voltage supported by kernel as the least among valid voltage.
-Period should be echoed as milli seconds.
-Voltage step should be a multiple of 50.
Small Tutorial: Suppose you need a pattern - short, long, short breathes. Let's call this .._ When a notification arrive, it will repeat until notification times out .._ .._ .._
#First enable breathing:
echo "1" > /sys/class/misc/notification/breathing
#Reset existing pattern:
echo "reset" > /sys/class/misc/notification/breathing_steps
#Now echo as many FADE INs and FADE OUTs you need. The file will parse all these without overwriting. (If you cat the file, it may return only last echoed line. Don't worry)
echo 2600 3300 30 150 > /sys/devices/virtual/misc/notification/breathing_steps //short breathe achieved using lower period and higher voltage steps
echo 3300 2600 30 150 > /sys/devices/virtual/misc/notification/breathing_steps //fade out for short breathe by swapping voltage limits
echo 2500 3300 60 50 > /sys/devices/virtual/misc/notification/breathing_steps //long breathe achieved by increasing period and decreasing voltage step
echo 3300 2500 60 50 > /sys/devices/virtual/misc/notification/breathing_steps //fade out for longer breathe
echo 2600 3300 40 150 > /sys/devices/virtual/misc/notification/breathing_steps //another short breathe
echo 3300 2600 40 150 > /sys/devices/virtual/misc/notification/breathing_steps //fade out
echo 2500 2500 400 50 > /sys/devices/virtual/misc/notification/breathing_steps //Having same voltage limit (that too 2500 which won't turn on led) and some period means a pause between breathing cycles. This will give a relaxed effect.
Q. How can i achieve blinking?
A. Echo same voltage as min and max voltage for Fade in and Fade out effects.
echo "2500 2500 500 100" > /sys/class/misc/notification/breathing_steps
echo "3300 3300 500 100" > /sys/class/misc/notification/breathing_steps
Reducing the period to a smaller number say 100, gives you a faster blinking - a pulse effect.

New Governor(s)
Pegasusq Governor
Let's see what is pegasusq governor from Samsung which claims to be a multi core aware governor.
Some Basics to Remember Before Reading On:
Some patience is required to understand a governor.
Pegasusq is basically an ondemand based governor which also controls hotplugging.
Run Queue: We know mutiple processes can run at once on our device. These active processes are placed in an array called a run queue along with their priority values. (Priority is used by the task scheduler to determine which process is to run next) To ensure each process has a fair share of resources, each one is run for some time period then paused and placed back into the run queue. When a program is stopped to let another run - the program with the highest priority in the run queue is then allowed to execute.
Talking w.r.t to Android O.S and GS2 CPU, each core is given a run queue, which maintains both an active and expired array of processes. The scheduler selects the next process from the active array with highest priority. When a process' time period expires, it is placed into the expired array with some priority. When the active array contains no more processes, the scheduler swaps the active and expired arrays.
Wall Time is the total up time of CPU. Idle Time is the total idle time of the CPU. The difference (wall time minus idle time) gives CPU Busy Time. Load on CPU is calculated as percentage of Busy Time on Up Time. (Doesn't it make a lot of sense). Now you know exactly how is load measured.
Governor doesn't scale CPU but tells the CPU driver to do so.
Sampling means to evaluate load.
Smooth scaling is also done by CPU driver, not by governor.
Switching to pegasusq will deactivate Stand Hotplug since we don't need two logics to do the same thing at the same time and create conflicts.
Switching to a different governor from Stand hotplug will re-activate Stand Hotplug since we need a logic to control hotplugging.
Use scripts or SetCpu to change governor tunables.
Gokhanmoral modified pegasusq (originally authored by Samsung for quad core devices) in Siyah kernel to be dual core friendly.
Parameters:-
1) sampling_rate - Measured in uS and actual meaning being Sampling Interval, this factor determines how often the governor should poll for CPU usage in terms of frequency and load percentage to make scaling decisions - either scale CPU Up or scale it Down.
UNIT: Miscroseconds
2) up_threshold - Measured as percentage, when load on CPU is equal to above up threshold, CPU is scaled Up. Lower value - early scale up, and vice-verse.
UNIT: Percentage
3) sampling_down_factor - Acts as a multiplier for sampling interval for re-evaluating the load when CPU is truly busy and is on highest clock frequency (policy max). Setting to 1 makes no difference and causes CPU to immediately scale down from highest frequency. Sampling down factor is NOT valid for lower frequencies and low load conditions. Note that CPU is scaled up to max frequency when max_load_freq is greater than up_threshold*current frequency. (or to cur_freq + (freq_step * policy.max_freq) whichever is smaller) Max_load_freq is an arbitrary frequency calculated as the maximum of load_frequencies. Load_frequency is an arbitrary frequency which describes the frequency the device theoretically needs to handle 100% load, calculated as load*average_frequency.
To sum up, use non-zero sampling_down_factor to avoid governor jumping down to lower frequency even on high CPU load.
UNIT: Positive Integer
4) down_differential - After spending sampling_down_factor*sampling_rate micro seconds at maximum frequency on high load, governor samples the load again to calculate an approx target frequency to scale-down-to which should not trigger up_threshold in the next sample. (Triggering up threshold may cause jumping to max frequency again). Max_load_freq is checked against (up_threshold - down_differential) * current frequency. If found to be smaller, CPU is scaled down to a target frequency as described above. Down_differential also act as the factor to prevent aggressive scale down.
Higher value of down_differential corresponds to delayed scaling down.
UNIT: Positive Integer
5) freq_step - Defines how much as a percentage of maximum frequency, governor should increase CPU frequency each time CPU load reaches up_threshold.
UNIT: Percentage
6) cpu_up_rate - No of samples to evaluate load to scale CPU Up. After cpu_up_rate samples are finished for a frequency, CPU scale-Up logic is executed. In other words - before scaling Up, cpu_up_rate*sampling_rate micro seconds are spend at a frequency.
UNIT: Positive Integer
7) cpu_down_rate - No of samples to evaluate load to scale CPU Down. After CPU_down_rate samples are finished for a frequency, CPU scale-Down logic is executed. In other words - before scaling Down, cpu_down_rate*sampling_rate micro seconds are spend at a frequency.
UNIT: Positive Integer
8) hotplug_freq_1_1 - Up threshold frequency to turn second core On, when some other conditions is also met. ie If (minimum frequency greater than or equal to hotplug_freq 1 1 and run queue length is greater than hotplug_rq_1_1) Hotplug IN Second Core. Higher value correpsonds to delay in turning on second core.
UNIT: Kilo Hertz
9) hotplug_freq_2_0 - Down threshold frequency to turn second core Off, when some other conditions is also met. ie If (maximum frequency less than hotplug_freq 2 0 and run queue length is less than or equal to hotplug_rq_2_0) Hotplug OUT Second Core. Lower value correpsonds to delay in turning off second core.
UNIT: Kilo Hertz
10) hotplug_rq_1_1 - Threshold run queue length for second core to turn on.
UNIT: Positive Integer
11) hotplug_rq_2_0 - Threshold run queue length for second core to turn off.
UNIT: Positive Integer
12) freq_for_responsiveness - Until freq_for_responsiveness, Up Threshold considered for sampling load is up_threshold_at_min_freq. Also during the part where CPU is at maximum load frequency, governor need to find the optimal frequency as the next frequency - which should not trigger up_threshold in the next sampling. When such a frequency_next is found to be a) less than freq_for_responsiveness b) will not trigger down_threshold in the next sample, then the optimal frequency is set to freq_for_responsiveness.
13) up_threshold_at_min_freq - This threshold is used as up threshold while sampling at frequencies less than freq_for_responsiveness. Above that, normal up_threshold is used. This gives us an option to make scaling aggressive/relaxed until a frequency and normal for higher frequencies. Again, during calculation of optimal frequency which should not trigger up policy, down threshold to consider is difference between up_threshold_at_min_freq and down_differential
14) ignore_nice_load - Setting to 1 causes governor to ignore load resulted by nice processes while making scaling decisions. Nice processes are the one i/o scheduler refers to as low priority process.
UNIT: Boolean 1 or 0
15) io_is_busy - Setting to 1 causes treating i/o wait time as CPU busy time. I/O busy is just an indication that CPU is performance critical, and system is not actually idle. IO wait time is excluded from the CPU idle time value is 1.
UNIT: Boolean 1 or 0
16) max_cpu_lock - If set to zero, hotplugs in and out second core when appropriate. Otherwise specifies no of cores to be considered for hotplugging. Leave it as default 0.
UNIT: Integer 0/1/2
17) hotplug_lock - Hotplugging second core is cancelled if it's value is greater than zero. The value should be greater than value of max_cpu_lock for a non-zero value. Leave it as 0.
UNIT: Integer 0/1/2
18) *cpu_up_freq - Calculated as minimum of (its current value and maximum frequency), this tunable is actually not used by the governor.
UNIT: Kilo Hertz
19) *cpu_down_freq - Calculated as maximum of ( its current value and minimum frequency), this tunable is actually not used by the governor.
UNIT: Kilo Hertz
20) *up_nr_cpus - Calculated as minimum of (its current value and num of possible cpus), this tunable is used by the governor to indirectly make Hotplugging decisions, but may not be useful for a 2 core CPU.
UNIT: Integer 1/2
21) dvfs_debug - Set to 1 to enable governor logging. If you're an enthusiast, this may be useful to view the impact of the values for governor tunable set by inspecting the log.
UNIT: Boolean 1 or 0
* - Parameters removed in siyah kernel since they're not actually used in the governor code.
Sample Tweaks:-
Assuming - i) You have 18 steps freq table ii) Scaling min is not greater than 200 mhziii) Scaling max is not less than 1000 mhz
Aggressive
Code:
echo "75" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold
echo "65" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold_at_min_freq
echo "40000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate
echo "2" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential
echo "60" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step
echo "400000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate
echo "400000" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_1_1
echo "300000" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_2_0
echo "200" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_1_1
echo "150" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_2_0
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/ignore_nice_load
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/max_cpu_lock
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_lock
Relaxed
Code:
echo "90" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold
echo "80" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold_at_min_freq
echo "60000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor
echo "5" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step
echo "300000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness
echo "15" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate
echo "15" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate
echo "500000" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_1_1
echo "300000" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_2_0
echo "350" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_1_1
echo "200" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_2_0
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/ignore_nice_load
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/max_cpu_lock
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_lock
My Settings: I don't want unnecessary power drain, and don't want lag to save extra juice. Scaling from 200 to 1200 with every frequency that's multiple of 100 in the table.
Code:
echo "80" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold
echo "40" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold_at_min_freq
echo "40000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate
echo "2" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor
echo "5" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential
echo "40" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step
echo "200000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate
echo "400000" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_1_1
echo "300000" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_2_0
echo "300" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_1_1
echo "200" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_2_0
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/ignore_nice_load
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/max_cpu_lock
echo "0" > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_lock
Once again, note that stand hotplug is disabled when pegasusq is active. After setting your values, just make sure you didn't configure pegasusq wrong where only one core is on all the time or both cores are online all the time. Open tegrak second core app and make sure second core turns on when needed and turns off when done.
Points to Note While Tweaking Pegasusq:-
1) Actual sampling interval is not the value of sampling_rate since load is evaluated after cpu_up_rate number-of-samples while scaling up and cpu_down_rate times number of samples while scaling down. So don't go for big values for sampling_rate. You're not saving battery but causing lags.
2) Always make sure that directly related parameters are rightly configured. For example a sampling_rate of 50000, cpu_up_rate of 10, cpu_down_rate of 20 means load is sampled after 10*50000=1000000=1 second for scale up and 20*50000=2 seconds for scale down.
3) Let value of down_differential always be between 5 and 10. Atleast 5 and 15. The difference between upthreshold and down_differential is considered as the percentage against current frequency to find a frequency to scale down to when CPU was on max_load_frequency. (This max_load_frequency is not your scaling_max_frequency. It's an arbitrary freq which is something smaller than that)
4) We know frequency jumps straight to max a little too often with ondemand based governors. One situation where this could happen is when max_load_freq is found to be greater than up_threshold percentage of current frequency. (If current frequency + (freq_step * policy.max_freq) is smaller than max frequency, it will jump to this frequency instead). So it's better not to go with very low up_threshold.
5) sampling down factor is the number of samples to spend at highest CPU frequency before re-evaluating the load. Setting to 1 may be battery friendly but also causes scale down even if CPU was very busy. A trade-off value is 2. High sampling_down_factor is not recommended. We don't need CPU to stay at highest freq forever.
6) Setting freq_step = 100% voids the reason for it to exist. Let it be something between 20% and 50% / 60% depending on your need. Note that smooth_scaling and freq_step does the same thing. Use only one of them at a time.
7) Hotplug up frequency (hotplug_freq_1_1) should be greater than hotplug down frequency (hotplug_freq_2_0). Also, hotplug_down frequency should be greater than your scaling minimum frequency. Else second core might not turn off after it kicks in.
8) Hotplug runqueues values affects second core activate/deactivate decisions based on no of threads running or no of processes kept in run queue. Let their values be between 200 and 350. If you need second to turn on quickly and turn off slowly, use low values for up rq and down rq.
9) freq_for_responsiveness is the frequency that aids in recalculating a frequency_next to scale down to from maximum frequency. When i) that frequency_next is found to be less than value of freq_for_responsiveness and ii) if by scaling down to that frequency, next sample won't cause a scale down, then the frequency_next is set to freq_for_responsiveness. (This prevents scaling down to a low frequency where next sample will cause a scale up). A frequency in the bottom half of your frequency table is a sensible value for this parameter. To disable use of this param, set it to your scaling minimum frequency.
10) up_threshold_at_min_freq is the up threshold for frequencies below freq_for_responsiveness. Value of this should depend on how low or high your freq_for_responsiveness is. If you need relaxed scaling till freq_for_responsiveness, use higher values for up_threshold_at_min_freq. And vice-verse.

Kmemhelper Binary - Virtual Kernel Hacking
kmemhelper
Warning: Slightly advanced topic. It's not so easy to understand, not so difficult either.
kmemhelper is a binary which you may use in scripts or adb to change values of some global static variables which in turn changes some parameters. Now, what's so special about it? We don't need to wait for device files and misc files as interfaces to parse the values we echo - to change some settings. Instead, the global static symbols in the kernel can be directly controlled by kmemhelper and create wonders.
Examples include changing smooth scaling param, change bus frequencies, change CPU internal voltages, change different touch thresholds and parameters, change touch frequencies, etc. Possibilities are quite large, provided you know the name of the variables, their type and valid values. You can find kmem binary in /system/xbin. Permissions should be 755.
Without waiting for change in kernel code to support certain settings changes, we simply use kmemhelper to have better control on many settings and features.
Working:
kmemhelper takes atleast four arguments.
Ex: kmemhelper -n smooth_level -t int
Modifier n refers to Name of the symbol. Modifier t refers to Type of the symbol. Above example echoes back the value of the variable "smooth_level" which is an integer. If you need to set a value for this variable, specify it as the last argument.
kmemhelper -n smooth_level -t int 8
This set smooth_level to 8 which is L8 in the frequency table. In an 18 steps frequency table, this is 800 mhz.
If the static variable is a structure or single dimensional/multi dimensional arrays, we should use offsets to specify the variable(s) we're changing. Modifier o specifies offset.
Syntax is
PHP:
kmemhelper -n <var_name> -t <var_type> -o <offset_value> <new_variable_value>
PHP:
Ex: kmemhelper -n mxt224_data -t char -o 59 50
This line changes value of a character variable to 50, in struct mxt224_data. The character variable is at 59th byte offset in the struct.
Calculating Offset:
Depending on the position and type of variable in a struct/array, we need to calculate offset correctly before using them.
Offset sizes are:-
int - 4
short - 2
char - 1
pointers - 4
Suppose there's a
struct Xyz
{
int a;
char b;
int c;
short d;
}
To refer "a" use offset 4. To refer to b use offset 4+1=5, for c 9, d 11 etc.
For example in mxt224_data which is a struct defined in arch/arm/mach-exynos/mach-u1.c symbol to change the value of touch threshold can be referred as:
kmemhelper -n mxt224_data -t char -o 58 35
This changes value of touch threshold which is MXT224_THRESHOLD_BATT_INIT located at offset 58 in the struct to 35%.
I want to learn about more Configurable Symbols:
You can find them all by cating kallsyms
cat /proc/kallsyms
Suppose you found an interesting variable and you need to know more about it. What you can do is download the kernel source, navigate to its root directory and search for this variable name.
find /path/to/possible/dir/in/kernel -depth -exec grep <varname> {} +
Now you know the file which contains the symbol/variable. After browsing code and understanding what it does and it's possible values, use kmemhelper in a script to change the values.
Sometimes, on different builds, the names of some symbols may change especially if there are similar variables with different suffixes. In such cases, kallsysms can be used to find the exact symbol name.
Example: LVL=`cat /proc/kallsyms|grep " level\."|awk '{print $3}'`;kmemhelper -n $LVL -t int
As you can see kallsyms content is read to retrieve all symbols. We narrow down results by searching for symbols containing "level" in their names. We pipe this result to awk '{print $3}' which apply print action to all the lines for the third column. Now LVL will contain the symbol name which defines touch frequency (Frequency to which CPU jumps when the screen is touched). Symbol name may be level.23175. We use kmehlper to view the value. It may retun 11 which is L11 = 500mhz in the frequency table.
We use the same command to set a new value to change the touch frequency.
LVL=`cat /proc/kallsyms|grep " level\."|awk '{print $3}'`;kmemhelper -n $LVL -t int 14
This changes touch frequency to 200. If the scaling minimum frequency is 200 mhz, frequency won't jump on screen touch. (Look in voltage control or setcpu to confirm). This could save some battery.
Other Useful Symbols:
For mxt224_data struct, change these variables to alter touch responsiveness.
# offset 59: MXT224_THRESHOLD_BATT_INIT - touch threshold on battery
ex: kmemhelper -n mxt224_data -t char -o 59 50
# offset 60: MXT224_THRESHOLD_CHRG - touch threshold on charging
kmemhelper -n mxt224_data -t char -o 60 55
# offset 61: MXT224_NOISE_THRESHOLD_BATT - noise threshold battery
kmemhelper -n mxt224_data -t char -o 61 30
# offset 62: MXT224_NOISE_THRESHOLD_CHRG - noise threshold charge
kmemhelper -n mxt224_data -t char -o 62 40
# offset 63: MXT224_MOVFILTER_BATT - movfilter battery
kmemhelper -n mxt224_data -t char -o 63 11
# offset 64: MXT224_MOVFILTER_CHRG - movfilter charging
kmemhelper -n mxt224_data -t char -o 64 46
# offset 67: MXT224E_THRESHOLD_BATT - touch threshold battery for mxt224e chip
kmemhelper -n mxt224_data -t char -o 67 50
# offset 77: MXT224E_MOVFILTER_BATT - movfilter battery for mxt224e chip
kmemhelper -n mxt224_data -t char -o 77 46
-Smooth Scaling (Defined in arch/arm/mach-exynos/cpufreq.c)
symbol: smooth_level which is an integer
Takes frequency level values as input to define the smooth scaling frequency of governor.
-Bus Frequency (Defined in arch/arm/mach-exynos/busfreq.c)
symbol: exynos4_asv_volt which is an array of integers.
Takes voltage in mv as input
NOTE
1) If you echo wrong value, or specify wrong offset (thus pointing to a different symbol), it may cause crash/reboot.
2) To prevent echoing back the value to console while we're setting a symbol value , use output console as /dev/null 2>&1
Example: kmemhelper -n smooth_level -t int 8 > /dev/null 2>&1
if we use only > it will output stdout to that file
we have 3 standard i/o - stdin (0), stdout(1), stderr(2)
2>&1 implies to redirect error to out first, so that everything will be directed to /dev/null.
I will try adding more useful symbols with their purpose, type, offset and possible values.

Misc Faqs on Kernel Stuffs
Kernel users ask a lot of questions - be it development thread or discussion thread. With this post, i hope to aggregate many such questions and even more questions along with answers. I have arranged them randomly - in no particular order. There will be basic and advanced questions. Some answers may be short some may be too long. Try "ctrl+F" in your browser and search for a keyword. You may find the answer you're looking for.
1) "Is it possible to have different default governors for recovery and rom?"
A. Yes.
2) "Governor in recovery?"
A. Ondemand. Not changeable from userspace.
3) "Is there a separate I/O sheduler in recovery? Can it be diff from rom default?"
A. Yes, it can. To support huge amount of writes to sdcard (for ex: with dual boot options), devs may use a different i/o scheduler in recovery. Noop would be apt.
4) "Governor while charging phone when it's off?"
A. The governor is virtually powersave. Because while phone is off and is on charging - device and kernel is ON but there's no background processes running. So frequency will be locked to 200/100 mhz - depending on your lowest frequency.
Also, charging when device is on in airplane mode is almost equal to charging when device is off. Except cell radio, other background processes in airplane mode shouldn't be hogging CPU too much.
5) "Why is resetting extweaks profile recommended sometimes after a kernel flash?"
A. Your profiles are stored under /data/.siyah with ".profile" extension. ".active.profile" file under the same directory stores the name of your active profile. Contents in profiles are in the format "parameter"="<default_value> format. Sometimes there will be change in extweaks interface :-
i) Some new tunables were added
ii) Some tunables were removed
iii) Transposition of some tunables
iv) Default value of some tunable was changed.
When such a change occurs, your profiles should know it too so that it can contain all the parameters. That's why you have to reset profiles after a new kernel flash if it changes something in extweaks.
Resetting simply copies .profile files from /res/customconfig to /data/.siyah . You can do it manually using a file manager to avoid a reboot to recovery and back to rom. From recent versions, Gokhan auto detect changes in extweaks configuration between your existing & new kernel version to auto reset extweaks profile. The check is achieved by md5 sum checks between existing /res/customconfig/customconfig.xml and new one.
6) "How to change mount point for NTFS-sticks from /mnt/ntfs to another location for NTFS usb disks?"
A. Mounting ntfs sticks are managed by /sbin/hotplug script which is called on every plugging and unplugging operations and it includes usb sticks.
We can have an initd script which mounts rootfs in rw and replace that script to modify the location. Script should
1. mount -o remount,rw /
2. rm /sbin/hotplug
3. echo some lines to /sbin/hotplug to create the string you have prepared
4. chmod 755 /sbin/hotplug
7) "What happens if i set single/dual core mode and is on pegasusq?"
A. At the moment, pegausq override the setting and force system to dynamic hotplug mode. Anyhow, it is supposed to respect single core/dual core mode setup and behave like pure ondemand. Dev may make changes in the governor soon.
8) "I feel brightness is still high even at lowest brightness level while reading in dark?"
A. Reduce gamma using extweaks.
9)" Which hotplug logic is used with pegasusq?"
A. Stand hotplug which was introduced on ics which is multi thread aware. (Other hotplug logic is legacy hotplug which is default on gingerbread and is also available in ICS)
10) "Bln and testmode was working perfectly until a new kernel flash. Now there seems to be a problem."
A. Open extweaks. Disable bln - apply changes, enable bln - apply changes, reboot.
11) "What exactly is smooth scaling?"
A. Ondemand governor jumps straight to max frequency a little too often. We can control this by setting a smooth scaling frequency to which the CPU will scale to first before scaling to maximum frequency. A little power saving is the target here. Note that CPU driver does smooth scaling - not governor. When CPU driver is requested by governor to scale up to max frequency, it first scales to smooth frequency, and only in the next sampling to highest frequency. Smooth scaling atm is active for ondemand and pegasusq.
12) "What happens if i set smooth scaling freq to more than my scaling max frequency?"
A. Cpu driver will jump freq to that before scaling to max freq. So make sure you set it below max freq.
13) "How to insert a module that's available in /system/lib/modules?"
A. Safe to be root. In terminal or adb
su
insmod /lib/modules/<module_name.ko>
14) "How to know which modules are pre-loaded by kernel?"
A. Terminal or adb:
lsmod
15) "Why do i feel there's more wake up lag with ICS compared to gingerbread?"
A. ICS kernels has a resume time of 1000ms (one second) compared to 650ms in gingerbread. This time is just to resume the kernel from deep sleep. Note that a little more time is required to resume other background processes.
16) "I'm finding it difficult to underclock to below 800 mhz. Why?"
A. Frequency on GS2 is locked to 800mhz while entering and exiting deep sleep. Boot-loader resumes at 800mhz. Configuring this frequency at kernel level to something lower could cause a lot of SODs on many devices. Anyhow - your underclocking frequency shouldn't be below 800 mhz because of the mentioned reason.
17) "What is screen touch frequency?"
A. It's the frequency the CPU driver jumps CPU to when the screen is touched. Open voltage control/setcpu. Touch the screen and don't take off the finger. You can see CPU at 500mhz. This is the default in most of the custom kernels. Samsung default was 1000 mhz.
18) "Can i change touch screen frequency?"
A. Yes. With kmemhelper interface on supported kernels like Siyah.
You need to lower the frequency. Ideally to your scaling minimum frequency whether it's 100 or 200mhz. First find the level number of frequency from your freq table. Example: if you use 18 steps frequency table, L0=1600 L1=1500 L2=1400..... L14=200mhz L15=100mhz
Put this line in one of your init.d scripts
TF=`cat /proc/kallsyms|grep " level\."|awk '{print $3}'`;kmemhelper -n $TF -t int 14
Replace the last parameter - 14 with the level number of frequency you want to set. After executing this line, open voltage control again, touch screen and hold. You will see frequency did not jump and stayed at 200mhz.
19) "What are the basic things i should take care of when i echo my custom frequency steps to scaling_available_frequencies table?"
A. 1) Valid frequencies are 1600, 1500, 1400, 1300, 1200, 1100, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 50, 25 in Mhz.
2) Valid frequency is a multiple of four
3) If you're undervolting via an app or script,make sure you set proper voltages and enough voltage steps depending on your frequency step count. Wrongly parsed voltages may result in a non-booting device.
4) ExTweaks settings are applied only during initial boot stage. Any settings that uses frequency level numbers - L0, L1, etc etc should be properly configured to work with your new frequency steps. Best examples are Smooth Scaling parameters and governor settings (like lulzactive screen_off_min_step. Value is 5 in a 7 Step freq table points to a max cap of 500 mhz and max cap of 800mhz in a 9 step table.
5) You can not skip frequencies - 500, 800 and 1000 when you're echoing custom frequency steps.
20) "Why should Not we use high thresholds for hotplugging unlike we did on gingerbread"?
A.We have multiple hotplugging logics on ICS. One is Stand Hotplug (default in most of the ICS kernels) another one is Legacy Hotplug (this was also the logic in gingerbread).
In legacy hotplug (remember loadh, loadl, load_scroff, loadl_scroff etc on GB), the thresholds directly mapped to the current load percentages. At any frequency, if load on CPU is greater than loadh, second core will kick in.
But equations are different in stand hotplug. Stand hotplug aims to calculate load using current load and current frequency. It will make more sense looking at the load calculation equation.
Average Load = (current_frequency * load) / max_performance [where max_performance = max_frequency * no_of_cpus]
Ex: Assume current frequency = 500 mhz load = 70% and max frequency = 1200 mhz
=> average_load = (500*70) / (1200*2) = 23%.
From this it's obvious that second core would kick-in at a 70% load on CPU running at 500mhz only if load_h is set to 23% or less.
Let's calculate theoretically what's the max value for load_h that's valid.
To calculate highest average load, current frequency should be maximum (it should equal max freq) and load should be max (100%).
Highest Average Load = (MaxFreq*100) / (MaxFreq*2) = 50%. So theoretically, load_h can have a max value of 50%. You set anything above, second core won't turn on and the setup will work like single core mode. Practically, the values should be even lesser. I recommend using load_h= 25% and load_l = 10%.
21) "I don't see an init.d folder in my rom. I wanna create some initd scripts. What to do?"
A. Using a root explorer create init.d directory under /system/etc. Set perm 777.
22) "Difference between tar and cwm versions of kernels?"
A. No significant difference. Tar just has the raw kernel image - zimage which you can flash using cwm app/recovery/even adb. Zip has the same zimage with installation script that writes raw image to kernel partition.
23) "After flashing a new kernel i see there are some stuffs missing from extweaks"
A. Either the support for those missing tunables were removed or just the extweaks interface was removed. The parameters might still be accessible through scripts. Check the file path to make sure.
24) "How to know which hotplugging logic is used in the current kernel build?"
A. Navigate to /sys/module using a file explorer. If you find stand_hotplug directory, Stand Hotplug logic is used. If you find pm_hotplug directory instead, Legacy Hotplug is used.
Many more questions to come......

WOW
Why don't you build your own kernels?

sahibunlimited said:
WOW
Why don't you build your own kernels?
Click to expand...
Click to collapse
Because i like to spend my GS2-time tweaking and using the device rather than endlessly coding, making improvements and listen to mixed feedbacks from users
EDIT: After 10 minutes of opening thread, someone gave me a 1 star as first rating.

good stuff
I'll keep this handy the next time I finetune my own kernel.
Keep up the good work!

droidphile said:
Because i like to spend my GS2-time tweaking and using the device rather than endlessly coding, making improvements and listen to mixed feedbacks from users
EDIT: After 10 minutes of opening thread, someone gave me a 1 star as first rating.
Click to expand...
Click to collapse
Informative as always. Keep it up mate and very helpful as always threads that you make. Hopefully this becomes a sticky as it deserves to be. Thank you

Great thread mate, as its previous twin it will become another legend soon!
Sent from my SGS2 - Powered by CM9

Great info mista D. Im learning a lot thx to you man. Keep up with the excellent contributions. Topics like this got me stuck to xda. Thanks!
Sent from my GT-I9100 using XDA

Hmm.. seems legit.
Thanks for info. Great learning from you. =)

you are simply the best when it comes to kernels, your knowledge on kernels is outstanding!

Great topic !
A very best of ! Thanks for all those informations mate
Cheers

thank you
thank you very much for this, very well written and easy to understand, time to start putting some tweaks into action

I'm curious, all that:
echo XXX > /sys/devices/......
Where did you find those commands? Exist some kind of reference or is from a file in the kernel source?

droidphile said:
Because i like to spend my GS2-time tweaking and using the device rather than endlessly coding, making improvements and listen to mixed feedbacks from users
EDIT: After 10 minutes of opening thread, someone gave me a 1 star as first rating.
Click to expand...
Click to collapse
The one star guys is probably an ignorant idiot that didn't understand any word here. Awesome job.
Envoyé depuis mon GT-I9100 avec Tapatalk

i was hoping for a thread like this for a long time have tried extweaks in every position but now i know what i am actually doing
thanks!

hjuo said:
I'm curious, all that:
echo XXX > /sys/devices/......
Where did you find those commands? Exist some kind of reference or is from a file in the kernel source?
Click to expand...
Click to collapse
Some of the locations are same as in GB kernels. Rest we can search and find out. And yeah, even sources can help. For example, file that's responsible for hotplugging on ics is stand-hotplug.c; and there's a stand_hotplug directory under sysfs...

Great work, man. Very thorough, very informative.
screamworks.

Related

CPUFreq Governor Info

A plethora of info on CPU governors (source):
CPU frequency and voltage scaling code in the Linux(TM) kernel
L i n u x C P U F r e q
C P U F r e q G o v e r n o r s
- information for users and developers -
Dominik Brodowski <[email protected]>
some additions and corrections by Nico Golde <[email protected]>
Clock scaling allows you to change the clock speed of the CPUs on the
fly. This is a nice method to save battery power, because the lower
the clock speed, the less power the CPU consumes.
Contents:
---------
1. What is a CPUFreq Governor?
2. Governors In the Linux Kernel
2.1 Performance
2.2 Powersave
2.3 Userspace
2.4 Ondemand
2.5 Conservative
2.6 Interactive
2.7 MinMax
2.8 SmartassV2
3. The Governor Interface in the CPUfreq Core
1. What Is A CPUFreq Governor?
==============================
Most cpufreq drivers (in fact, all except one, longrun) or even most
cpu frequency scaling algorithms only offer the CPU to be set to one
frequency. In order to offer dynamic frequency scaling, the cpufreq
core must be able to tell these drivers of a "target frequency". So
these specific drivers will be transformed to offer a "->target"
call instead of the existing "->setpolicy" call. For "longrun", all
stays the same, though.
How to decide what frequency within the CPUfreq policy should be used?
That's done using "cpufreq governors". Two are already in this patch
-- they're the already existing "powersave" and "performance" which
set the frequency statically to the lowest or highest frequency,
respectively. At least two more such governors will be ready for
addition in the near future, but likely many more as there are various
different theories and models about dynamic frequency scaling
around. Using such a generic interface as cpufreq offers to scaling
governors, these can be tested extensively, and the best one can be
selected for each specific use.
Basically, it's the following flow graph:
CPU can be set to switch independently | CPU can only be set
within specific "limits" | to specific frequencies
"CPUfreq policy"
consists of frequency limits (policy->{min,max})
and CPUfreq governor to be used
/ \
/ \
/ the cpufreq governor decides
/ (dynamically or statically)
/ what target_freq to set within
/ the limits of policy->{min,max}
/ \
/ \
Using the ->setpolicy call, Using the ->target call,
the limits and the the frequency closest
"policy" is set. to target_freq is set.
It is assured that it
is within policy->{min,max}
2. Governors In the Linux Kernel
================================
2.1 Performance
---------------
The CPUfreq governor "performance" sets the CPU statically to the
highest frequency within the borders of scaling_min_freq and
scaling_max_freq.
2.2 Powersave
-------------
The CPUfreq governor "powersave" sets the CPU statically to the
lowest frequency within the borders of scaling_min_freq and
scaling_max_freq.
2.3 Userspace
-------------
The CPUfreq governor "userspace" allows the user, or any userspace
program running with UID "root", to set the CPU to a specific frequency
by making a sysfs file "scaling_setspeed" available in the CPU-device
directory.
2.4 Ondemand
------------
The CPUfreq governor "ondemand" sets the CPU depending on the
current usage. To do this the CPU must have the capability to
switch the frequency very quickly. There are a number of sysfs file
accessible parameters:
sampling_rate: measured in uS (10^-6 seconds), this is how often you
want the kernel to look at the CPU usage and to make decisions on
what to do about the frequency. Typically this is set to values of
around '10000' or more.
show_sampling_rate_(min|max): the minimum and maximum sampling rates
available that you may set 'sampling_rate' to.
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 '80' it means that between the checking
intervals the CPU needs to be on average more than 80% in use to then
decide that the CPU frequency needs to be increased.
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.
2.5 Conservative
----------------
The CPUfreq governor "conservative", much like the "ondemand"
governor, sets the CPU depending on the current usage. It differs in
behaviour in that it gracefully increases and decreases the CPU speed
rather than jumping to max speed the moment there is any load on the
CPU. This behaviour more suitable in a battery powered environment.
The governor is tweaked in the same manner as the "ondemand" governor
through sysfs with the addition of:
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.
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.
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.
There is only one tuneable value for this governor:
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.
2.7 MinMax
---------------
The CPUfreq governor "maxmin" tries to minimize the frequency jumps by limiting
the selected frequencies to only two frequencies: either the min or the max
frequency of the current policy. The frequency is raised or lowered according
to the current load and the 'up_threshold' and 'down_threshold'.
Its parameters and implementation are similar to that of conservative.
It does not have the freq_step parameter as it jumps right from min to max
and vice-versa.
The sampling_down_factor, unlike conservative, will count the minimal number
of samplings since the last time we saw the 'up_threshold' load on the CPU.
Hence it is set to higher default and acts as a limiter not to do too many
frequency jumps without hurting the performance.
2.8 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).
Click to expand...
Click to collapse

Kernel][ICS] Devil3_1.1.0 [02/08/12] - Cappy

This kernel is based on teamhacksung's kernel, with updated Linux base to 3.0.38
This kernel is working with every ICS based Rom
Features:
- 378, 391 and 403 Mb Ram available (selectable in kernel, no need for a patch (403 mb breaks 720p) only reboot required)
- 2 different recoveries included (cmw touch recovery + twrp recovery (to use TWRP, just create a file named "twrp" at /cache))
- SIO scheduler (default)
- V(R) scheduler (maybe even faster than SIO, can be set as default by using NSTools for example)
- init.d
- Voodoo Sound and CM9 Color Adjusment / Voodoo Color (VC version)
- Devil Idle
- BLN V9 (thx to mialwe)
- USB Host mode driver (for more information about this, and for saying thanks to the guy, who ported this for our phone, please visit this thread: http://forum.xda-developers.com/showthread.php?t=1450298 )
-Ezekeel's Live_Oc
- Ezekeel's Deep Idle V2
- Touchwake
- vibrator intensity control (by mialwe)
- BLX (Batterie Life Extender, I don't think we need it, but maybe one feels better by using it )
- backports from Linux 3.2 and 3.3
- Swap/Zram support
- Zcache, Cleancache and Frontswap
- Uksm
- Fiops io scheduler
- Smooth_ui included to ondemand, conservative, smartass, lulzactive, lagfree and lazy governor (only one setting for activating/deactivating it in general)
- 3 cpu governor presets (smooth, normal, powersave) for ondemand, conservative, smartass, lulzactive, lagfree (only one setting for switching the mode in general)
- many other small features and improvements
Donwload and Changelog post 2
FAQ and known issues in post 3
Click to expand...
Click to collapse
Many of the features (like Live_OC) require NSTools, which can be found at market for free.
NEW:
Devil kernel Config: http://forum.xda-developers.com/showthread.php?t=1715383
Devil Kernel Manager: http://forum.xda-developers.com/showthread.php?t=1723222
Both Apps are really great. Please try on your own, which one you like more.
you still can use the previous methods of setting up the kernel:
Please also try this app http://forum.xda-developers.com/showthread.php?p=22430406, for setting many of the options which are only available with my kernel.
a pre configured file for use with command center can be found here: http://forum.xda-developers.com/showpost.php?p=27353078&postcount=240 (you have to remove .zip extension)
a good explination/example of how to use it, can be found here: http://forum.xda-developers.com/showpost.php?p=26301176&postcount=4842
if you don't like additional apps (or are having problems with command center), i recommend using this init.d script: http://forum.xda-developers.com/showpost.php?p=26683004&postcount=5346
Click to expand...
Click to collapse
Kernels with VC in the name are coming with Voodoo Color
oliva94 said:
IF the kernel zip name contains _JB_, THEN and only then you can use it IF you do NOT have datadata partition
ELSE if you HAVE datadata, then use one WITHOUT _JB_ in the name
if you use it otherwise, it will boot but system is eventually going to crash/not load due to partition table (thus blockdevice naming) mismach
Click to expand...
Click to collapse
Many Thanks to:
Teamhacksung
Zacharias.maladroit
Onecosmic
ytt3r
TK Glitch
Ezekeel
Eugene373
franciscofranco
Sunra
scheichuwe
perka
sztupy, for his great work, to get usb host mode driver
mialwe
stratosk
F4k for the idea to flash bigmem libs
...
sources:
https://github.com/DerTeufel
Click to expand...
Click to collapse
This kernel is also available for:
Captivate, Fascinate and Vibrant
Click to expand...
Click to collapse
Working on this kernel is taking many hours almost every day. With a small donation, you show me, that my work is appreciated by you.
If you like this kernel, please donate to me
Changelog:
changelog 02.08.2012:
- bug fix to bln, to prevent kernel panic in some situations (thx to thalamus)
- switched from deep_idle 2 to idle2 (also thx to thalamus)
- updated kernel to linux 3.0.38
- dockaudio sysfs for captivate and fascinate
- automated symlinking from data to system: if one wants to free up some space at /system, without removing an app completely, just copy it from /system/app to /data/sys-parts/app (create the folder if not there), and reboot. during reboot, the app from system gets deleted, and the app from /data/sys-parts/app gets symlinked to system. this is working for almost every app, but i don't recommend doing this with apps, needed for android to work (framework, media provider, settings,...)
IDLE2 can be enabled with the following command:
echo 0 > /sys/module/cpuidle/parameters/idle2_disabled
IDLE2 can be disabled with the following command:
echo 1 > /sys/module/cpuidle/parameters/idle2_disabled
Stats can be obtained from the standard cpuidle interface, which, for
IDLE2 is located at:
/sys/devices/system/cpu/cpu0/cpuidle/state*/time
where * = 1, 2, 3
changelog 25.07.2012:
- updated recovery (no "sdcard format"-bug anymore, external sd card is named correctly)
- vibrant: hopefully fixed froyo ril
- jellybean: galaxy s settings working now
changelog 22.07.2012:
This kernel is for use with ICS only, if you are looking for a kernel, running on teamhacksung cm10 build, visit my jellybean kernel thread[/url]
- updated kernal base to linux 3.0.36
- updated "block" to linux 3.3
- readded fiops io scheduler (kept cfq this time)
- updated cwm recovery to 6.0.1.0 (please create a new nandroid, because of possible incompatibilities between old/new recovery)
- compiled with linaro toolchain (gcc 4.7.1) and O3 compiler flags
- made uksm scan less often (save cpu time and power)
- at first boot: only delte init.d scripts created by other kernels
- increased usb write performance
- lowered ram and display voltages a little bit
- fixed some bugs related to devil settings (they should stick now after reboot, if set by one of the devil apps)
- support for scripts in /system/etc/shutdown.d (thx to Efpophis)
all scripts placed at /data/local/shutdown.d or /system/etc/shutdown.d get executed at shutdown/reboot
you can use this, to play a shutdown sound for example.
by default 00shutdown gets created, which plays a music file, when it is placed at one of these folders/places
/system/media/audio/ui/shutdown.ogg
/data/media/audio/ui/shutdown.ogg
Click to expand...
Click to collapse
- disabled some debugging options
- audio (and for fascinate: camera fixes) by Efpophis+
- patch for improving batterie life by CML
- nfts read/write driver built in (for use with usb host mode)
- reverted refreshrate_mod and gpu_oc mod, as both weren't working
changelog 18.06.2012:
- some changes to load balancing
- added ultra ksm (metioned by zach thx for this my friend)
- readded fiops io scheduler (still experimental and could cause instablilities)
- using snappy compression for zram now (2 times faster, but only 2% less compression)
- added the possibility to change zram size (at /data/local/devil/zram_size, with valid values: 50, 75, 100 and 150 (all in mb))
- fixed the applying of user_min/max freq after reboot
- vibrant: fixed gps
- fascinate: fixed nandroid in cwm recovery
what is ksm? http://en.wikipedia.org/wiki/Kernel_SamePage_Merging_(KSM)
uksm is more optimized and also working for single core systems. using this should give much better ram usage, but at the cost of more cpu usage
############# most probably not working (yet)##############
i have added seperate gpu oc from jt1134's galaxy_tab (to switch between 200 and 250 mhz), but i did not get any improvements in antutu...further tests needed
echo 1 > /sys/kernel/pvr_oc/pvr_oc (for 250 mhz)
echo 0 > /sys/kernel/pvr_oc/pvr_oc (for 200 mhz), no reboot needed
and also have changend default screen refreshrate from 60 to 56, with the possibility to change it:
echo 1 > /sys/kernel/refreshrate/enable (60 hz)
echo 0 > /sys/kernel/refreshrate/enable (56 hz)
######################################################
changelog 10.06.2012:
cwm recovery:
- fixed mounting of external sd card to pc
kernel:
- picked two commits from linux 3.0.32 (avoid a possible memory leak, small fix to ext4 driver)
fascinate:
- fixed wrong mount points
changelog 09.06.2012:
- updated Zram and Zcache from linux 3.3
- updated android binder driver from linux 3.3
- fixed restoring of backups within TWRP recovery
- added virtual buttons to cwm recovery (Attention: they still don't work!)
- call vol hack from tk glitch (take a look at init.d folder and edit the script to make changes to call vol hack)
- bigmem values get applied at first boot after power on (if there is a value at /data/local/devil/bigmem, 1 for 391 mb and 2 for 403 mb (the last one breaks 720p)
- prevent phantom key presses (from tk glitch)
changelog 24.05.2012:
- Smooth_ui included to ondemand, conservative, smartass, lulzactive, lagfree and lazy governor (only one setting for activating/deactivating it in general)
- 3 cpu governor presets (smooth, normal, powersave) for ondemand, conservative, smartass, lulzactive, lagfree (only one setting for switching the mode in general)
- no need for activating/deactivating of selective live_oc anymore --> just change target low and target high
- BLX back in
- fixes to devil idle to be more stable while in call
- 1,5 mb more ram (thanks to mialwe)
- added aroma filemanager to cwm recovery
- added fully working TWRP recovery optional to cwm recovery (to use TWRP, just create a file named "twrp" at /cache)
- added option to select ram config in kernel --> no need for flashing an other kernel to get more ram (thanks to stratosk)
- switched to new initramfs from stratosk and mialwe ( now there will be cmw zip and odin tar file of every kernel version)
- added possibility to use Zram instead of Swap
- no need for flashing/using special scripts to make swap/zram working anymore
- added zcache
- added frontpage
- added cleancache
- added fudgeswap (thanks to ezterry and faux123)
changelog 01.05.2012:
- all changes from cm9 stock kernel (including mount points option)
- some fine tuning to deadline and sio
- Devil Idle: limiting bus/ram/gpu speed to 100 mhz for 100-800 mhz cpu freq, while screen off (automatic mode) or always (permanet), both modes automatically reduce the int voltages of the affected freq by 50 mV
- compiled with swap support
- added stratosk's smooth_ui to lulzactive governor (activated by default)
- rest oc_value to 100 while screen off, and back when screen turns on (combined with devil idle automatic, can't be turn on/off without devil idle)
- added posibility for different voltages while screen off (also bundled with devil_idle, with default settings, stock arm voltages are applied, because of live_oc set to 100)
- added the possibility to set freq limits while screen off (min and max freq)
19.04.2012
- even better fix to selective live_oc (last one (in test kernel) generated some overhead)
- fixed sampling rate of ondemand and conservative (have ported mialwe's/stratosk's sleep multipliers)
- new tunables for ondemand and conservativ
sleep multiplier and tunables:
mialwe and stratosk had the great idea, to change the sampling rate of conservative and ondemand governor while display of. for this, he introduced the sleepmultiplier (in his case factor 3). this means, if you set sampling rate to 20000, it changes to 60000 while screen off, and back, when screen on.
for ondemand and conservative:
i have made this multipliers tunable. proper values are between 1 and 5, because one could want a higher multiplier while screen off, if sampling rate is very low while screen on (higher sampling rate means, less checking for work load --> better batterie, worse performance). with this tunables you get better batterie, without making the performance worse while screen on.
two other tunables: up_threshold_min_freq and responsiveness_freq
the first one is a very low threshold while on low freq (by default 40), to make the governor scale up faster, until the responsiveness_freq is reached.
the responsiveness_freq is set to 400000 (400 mhz) by default. while the freq is below this value, up_threshold is the same as up_threshold_min_freq, and freq jumps to responsiveness_freq, with skipping the freq between the actual one and the responsiveness_freq. (conservative governor does not jump up to this step)
responsiveness_freq can be set to values between 100000 and 1400000
up_threshold_min_freq can be set to the same values as the normal up_threshold.
not tunable: while screen off, up_threshold is set to 95, no matter your other settings, to save more batterie.
up_threshold_min_freq is disbaled by default for conservative governor
for lulzactive:
for this governor, i did similar things, but they are not tunable till now.
when screen off:
- inc_cpu_load is set to 90, and back to the original value, when screen turns on
- up_sample_time is set to 50000, and back to the original value, when screen turns on
- down_sample_time is set to 40000, and back to the original value, when screen turns on
other changes:
- fix to touchwake from ezekeel, and another fix from stratosk
- upstream fix to compass
- building for i9000B now, too (big thanks to F4k for the hints by pn )
- removed some typos from recovery
- removed some annoying "no's" and "yes" from recovery in misc menu
- fixed wifi mode switch (pm_fast is the one with better signal)
14.04.2012:
- new b versions (only stock ram) changend to 377 mb, VC version needs the 720p fix from my ftp server. cmc version already patched
13.04.2012:
- updated wifi driver
- added the possibility to switch between wifi PM_Fast and PM_Max mode (Pm_Fast = better signal, PM_Max = better batterie, default is PM_Max)
- user interface to disable fsync (this gives more performace, at the risk of data loss on a crash, taken from ezekeel, so it should be ok ), default is off, to be safe
- fixed voodoo color kernels (these have the VC in their names)
10.04.2012:
- added vibrator intensity control (by mialwe), presets can be changend in recovery
- stock ram version now available (348 mb ram), XL (390 mb), XL_bm (402 mb)
- removed 1080 mhz freq for now
- small correction to touchwake
- small correction to selective live_oc (now the low freq really are not live_oc'ed)
05.04.2012:
- fixed bug in selective live_oc, which caused the target high not taking affect to the highest freq, if highest freq equals target high
- fixed another bug in selective live_oc, which could lead to gpu crashes due to overclocking the ram, but not the cpu freq (for low steps)
- added a switch to change between "normal" and selective live_oc
by changing the live_oc mode while using it, live_oc value is set back to 100, to prevent strange things
- added possibility to set max. freq for boot (in recovery). This freq is set until init.d is executeted (it is automatically set to 1000 at this point, to make sure there are no conflicts with other cpu settings from users)
#Already in the last version, but i forgot about it:
- deep idle fixes from stratosk (many thanks)
- added possibility to underclock by using live_oc (limit is 90 now, which means lowering all freq and bus speed by 10%, to save more batterie when really needed)
03.04.2012:
For now there are three different RAM versions:
- stock mem kernel has 379 mb ram, everything working
- "slim ics" (XL) kernel comes with 390 mb, this is breaking playback of some high resolution videos
- XL_BM is coming with 402 mb ram, but breaking 720p
(while flashing the kernel, the modded rom files are also flashed, so you don't need to flash a new rom to get 379 or 390 mb)
-added new frequency: 1080 mhz (1100 does not like live_oc)
- fixed SmartassV2 for live_oc (after changing live_oc value, you have to change the smartass values, too, but then they automatically apply to the live_oc value (although you can only select 800 mhz in nstools (for example))
- touch recovery with custom devil menu (for some reason it takes a few seconds to load the first time, missing virtual keys is a warning, because there are no virtual keys yet)
-fast charge (thx to chad0989 for this), disabled by default.
you also can use the widget from chad (to place on homescreen) to toggle the fast_charge mode
https://play.google.com/store/apps/d...stchargewidget
Click to expand...
Click to collapse
while fast charge is activated you cannot connect as usb device
- added datafix script to init.d (this script is deactivated by deafult. to make it work, you have to creat a file named datafix and placed in /data/local/)
- reworking and cleaning many parts to get more ram, speed, and stability
05.03.2012:
- updated sio i/o scheduler to latest version
- small updates to ondemand and conservative governor from linux 3.2
- bettter performance for CFS kernel due to tuning and patches
- tuning to deadline scheduler
- better i/o performance
- changed bootlogo (probably not the last time )
28.02.2012
- finally working bln V9 (no need for LED2 anymore)
- fixed lockscreen freezes
- reverted memory tweaks, which could be the reason for lagging after using a day
- again wlan fixes from tk-glitch
- tweaked conservative and ondemand governor (conservative still is not too aggressive)
- added dm-cache again (who has removed this from my github? )
- improve usb signal quality
- xcaliburinhand's dock audio support (untested, do not have a dock)
- less debugging
- fixed kernel version not displayed under "about phone"
12.02.2012
- Added newest Fiops scheduler (tuned for more performance)
- When Gpu is active, min CPU freq is set to second lowest step
- fixes to live_oc and custom voltage
- default mount parameter NOATIME and NODIRATIME (faster)
- updated Wifi drivers (thanks to tk-glitch)
- tuned intellidemand for better performance
- removed some stuff (zram, swap, tweaks to cpufreq untill I know what was causing the instabilities of last build)
05.02.2012
- added Touchwake
- added BLX
- upgraded BLN from V8 to V9 (working for missed calls, blinking or static light, configurabel by using NSTools or BLN Pro App)
- added Intellidemand governor
- added mdnie settings to voodoo color version
- readded deep idle v2 again (I think it is the best/only working one, although
- version with CFS (instead of BFS) now also available (maybe better multitasking and batterie life, but slower)
- removed BFQ I/O Scheduler
- tons of smaller fixes and improvements
30.01.2012
-revert: Voodoo Sound now to be set with DSP Manager
29.01.2012
- Linux kernel 3.1.10
- Deep Idle from Eugene373 (always enabled, no stats)
- added BFQ v 3.1 I/O Scheduler
- Voodoo Sound now to be set with DSP Manager
- Zram (can be disabled by removing Zram file from init.d)
- Zcache and Cleancache (not working yet?)
- optimized rwsem algorithm
- USB Host V5
24.01.2012
- init.d support (the folder is not created by the kernel. You have to do it for yourself)
- Deep Idle V2 back in
- new Cpu governors: MinMax, Lagfree, Lulzactiv
- LED V2 (you can set blinking by using nstools, also working for missed calls in most cases (sometimes it is not working for missed calls, don't know why at the moment))
- Backlight Dimmer (only LED version): used to turn led backlight of, while screen is on, after defined period of time. Deactivating it, makes your backlight stay on all the time
- I/O-less dirty throttling completely backported from kernel 3.2
- Ext4 with 3.2 patches
- Proportional Rate Reduction for TCP - by Google
- USB Host V 4
19.01.2012
- Usb Host drivers integrated
- Cm9 Color adjustment
- Removed Deep Idle because of Bluetooth problems (hopefully it will come back, still testing)
16.01.2012:
- Updated Kernel basis to Linux 3.1.9
15.01.2012:
- fixed bug in cpu spy, caused by live_oc
- still using voodoo color for now, maybe two additional kernel versions tomorrow
Click to expand...
Click to collapse
files with .zip have to be flashed within recovery (twrp or cwm)
files with .tar can be flashed by using odin or heimdall (they are placed at the end of post 3)
ICS:
http://rootaxbox.no-ip.org/divers/ICS/ many thanks to Rootax
JellyBean (with default cm10 partition layout for use with teamhacksung's rom):
http://rootaxbox.no-ip.org/divers/jellybean/
http://devil.haxer.org/ many thanks to SysTem-X (not updatet yet)
Known issues:
- virtual buttons in cwm recovery not working
cappy specific:
- deep idle is causing some devices to not wake up again --> need to long press power button
Click to expand...
Click to collapse
How to:
you can change ram setting by doing the following ( to make these settings even stick after power off, you also have to echo the same value to to /data/local/devil/bigmem):
echo 1 > /sys/kernel/bigmem/enable (this gives you xl mem of 391 mb)
echo 2 > /sys/kernel/bigmem/enable (this gives you bm mem of 403 mb (this is breaking 720p))
echo 0 > /sys/kernel/bigmem/enable (this gives you cm9 default mem of 378 mb)
you have to reboot to make changes work
Click to expand...
Click to collapse
With setting this, your desired swap mode gets automatically applied at boot time. For swap, you have to create a swap partition at your external sd card before
echo 1 > /data/local/swap_use (for using swap partition on external sd card, you have to create this partition before)
echo 2 > /data/local/swap_use (for using Zram, no other modifications required)
you have to reboot to make changes active. You can't use swap and Zram at the same time
Click to expand...
Click to collapse
These are the settings for devil idle:
activate automatic:
echo 1 > /sys/devices/virtual/misc/devil_idle/bus_limit
permanent on:
echo 2 > /sys/devices/virtual/misc/devil_idle/bus_limit
deactivate
echo 0 > /sys/devices/virtual/misc/devil_idle/bus_limit_automatic
Click to expand...
Click to collapse
to set different voltages while screen off (this only is working, if devil idle automatic mode is activated)
this is an example, how to apply screen_off arm voltages:
echo 1450 1400 1350 1275 1075 975 875 800 > /sys/class/misc/customvoltage/arm_volt_screenoff
this way, it is possible to undervolt while screen off, but overvolt and overclock while screen on
for now, the int voltages can not be changend
Click to expand...
Click to collapse
set freq limits while screen off (min and max freq)
enable the limits:
echo 1 > /sys/devices/virtual/misc/devil_idle/user_min_max_enable
disable:
echo 0 > /sys/devices/virtual/misc/devil_idle/user_min_max_enable
set values to be applied if activated:
echo 100000 > /sys/devices/virtual/misc/devil_idle/user_min
echo 800000 > /sys/devices/virtual/misc/devil_idle/user_max
both are independent from devil_idle, and get applied when screen turns off
by default 100 and 1000 mhz are set.
values which can be put here are all "stock" freq (without live_oc level) multiplied with 1000. live_oc values get applied automatically.
Click to expand...
Click to collapse
to set responsiveness_freq, up_threshold_min_freq or sleep_multiplier for ondemand and/or conservative governor, you have to do it like this:
echo VALUE > /sys/devices/system/cpu/cpufreq/ondemand/VARIABLE_NAME
and
echo VALUE > /sys/devices/system/cpu/cpufreq/conservative/VARIABLE_NAME
example:
echo 400000 > /sys/devices/system/cpu/cpufreq/ondemand/responsiveness_freq
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_min_freq
echo 5 > /sys/devices/system/cpu/cpufreq/ondemand/sleep_multiplier
up_threshold_min_freq is disbaled by default for conservative governor
(to disable it for ondemand you have to set up_threshold_min_freq to 100.
Click to expand...
Click to collapse
switch between wifi PM_Fast and PM_Max mode (Pm_Fast = better signal, PM_Max = better batterie, default is PM_Max)
echo 1 > sys/module/bcmdhd/parameters/uiFastWifi (pm_fast)
echo 0 > sys/module/bcmdhd/parameters/uiFastWifi (pm_max)
Click to expand...
Click to collapse
user interface to disable fsync (this gives more performace, at the risk of data loss on a crash, taken from ezekeel), default is on, to be safe
echo 1 > /sys/devices/virtual/misc/fsynccontrol/fsync_enabled (fsync enabled)
echo 0 > /sys/devices/virtual/misc/fsynccontrol/fsync_enabled (fsync disabled)
Click to expand...
Click to collapse
to set the values for vibrator intensity:
echo value > /sys/class/timed_output/vibrator/duty (where value is between 20000 and 43640)
if you want the changes to be applied at boot, you have to use one of the presets from recovery, use an init.d script, or:
echo value > /etc/devil/vibrator (where value is between 20000 and 43640)
Click to expand...
Click to collapse
activate fast charge: echo 1 > /sys/kernel/fast_charge/force_fast_charge
Click to expand...
Click to collapse
deactivate fast charge
echo 0 > /sys/kernel/fast_charge/force_fast_charge
you also can use the widget from chad (to place on homescreen) to toggle the fast_charge mode
https://play.google.com/store/apps/d...stchargewidget
Click to expand...
Click to collapse
while fast charge is activated you cannot connect as usb device
Click to expand...
Click to collapse
Questions and Answers:
Q: What the hell are all these governors?
A: here you should find the answer: http://forum.xda-developers.com/showthread.php?p=19846297
Q: What's a good setup for live_oc??
A: No one knows. Every phone is different. It seems like the folling setup is running well for some (many?) users. If you get reboots with it, you have to find the setup for yourself.
if you are satisfied with this configuration, please hit the thanks button of Crack: http://forum.xda-developers.com/showpost.php?p=22194160&postcount=1246
.:Crack:. said:
OK, these are mine. Rock stable
LiveOC 117% -> 1200 MHz -> 1404 MHz
Freq/ARM/Init
1200/1400/1150
1000/1325/1125
800/1250/1125
400/1025/1100
200/900/1100
100/875/1000
low freqs could possibly be tweaked harder but stability was my fist goal
Click to expand...
Click to collapse
Q: How can I set up swap?
A: Take a look at this thread: http://forum.xda-developers.com/showthread.php?t=1610835, and especially at this post:
http://forum.xda-developers.com/showpost.php?p=25578231&postcount=83
Q: What is Touchwake? Can you explain it?
A: With Touchwake, the touchscreen still recognices your fingers, after turning off (for a predefined time (NSTools)). For a detailed explenation, take a look at Ezekeel's thread: http://forum.xda-developers.com/showthread.php?t=1239240
Q: How can I make Voodo Color settings been saved after reboot?
A: You have to use Voodoo Pro App, because of changes between Gingerbread and ICS, and only the Pro app is updated till now.
Q: Which is the best IO Scheduler?
A: I think SIO and V(R) are the fastest.
Q: How can I enable DeepIdle/Live_Oc?
A: You have to use NSTools. You find it on market. It's free.
Deep Idle Questions:
Q: How can I activate the deep idle stats?
echo 1 > /sys/class/misc/deepidle/stats_enabled
Q: What's the meaning of TOP=Off and TOP=On when I look at the Deep Idle status?
A: When TOP=Off is used, the best powersaving state is used. TOP=ON will be shown, when bluetooth or gps are running.
Q: In Idle status I only see TOP=On. What's wrong here? I don't use Bluetooth or Gps.
A: You have to flash the modded framework-res.apk, because ICS does not fully deactivate bluetooth by default. Even if you never use it.
Q: Idle Stats only are showing Idle, but no Deep Idle. Why?
A: An App is preventing the use of Deep Idle. At first, you should try closing the cam, running in the background. Also rebooting should solve this problem.
Q: What is fudgeswap?
A:
Setting this to a very large positive number will indicate swap ought
to be fully used as free (and will slow the system down)
smaller numbers will allow you to put some pressure on SWAP without
slowing the system down as much.
small negitive numbers will allow the system to be faster at the same
minfree level.
default is 512 to give a very little bit of pressure to use some swap
but this can be modified at runtime via:
/sys/module/lowmemorykiller/parameters/fudgeswap
Very nice, was looking forward to this! Thanks (;
Sent from my ICS Cappy
This looks very promising, going to be keeping an eye on it for sure.
Herp derp Captivate XDA Premium App.
I've been waiting for this for so long. Thank you
I really hope, that everything is working, especially the touchkeys...
Then I can start to add more, in about 6 hours.
Gesendet von meinem GT-I9000 mit Tapatalk 2
I've been waiting to see this in the Captivate Forum
thanks for the new kernel any chance you can write up a post about what each of the tweaks do im still trying to wrap my head around all the terms here lol
Nice to have another kernel around. What is the highest OC on it?
shaolin95 said:
Nice to have another kernel around. What is the highest OC on it?
Click to expand...
Click to collapse
1,4GHZ is the max step you can choose
Kernel runs smooth, games run very well at 1,1GHZ Step with 110%LiveOC SmartassV2 and Deadline
Touchkeys are working fine too
Edit:
The min min step is 200mhz
cant change it to 100
kevinnol said:
1,4GHZ is the max step you can choose
Click to expand...
Click to collapse
That, and there's also selective LiveOC so you can probably max out your phone's capabilities. I haven't flashed yet, just going off of the OP.
Herp derp Captivate XDA Premium App.
I will give it a shot..is not a big deal to test it
Hey DerTeufel1980, you make me wait so long
kevinnol said:
1,4GHZ is the max step you can choose
Kernel runs smooth, games run very well at 1,1GHZ Step with 110%LiveOC SmartassV2 and Deadline
Touchkeys are working fine too
Edit:
The min min step is 200mhz
cant change it to 100
Click to expand...
Click to collapse
this is because of the min freq is set to 200, while the gpu is active...in most cases, this is, when your screen is on
please check cpu spy stats, to see, that 100 mhz also is used.
but, i am going to remove it, cause everyone can set 200 mhz as min, if he/she likes to.
In the Recovery are 3 different profiles, when i choose as example smooth profile what changes are made ?
Looked into the i9000 thread but cant find the answer
Testing
Testing with Doc's Master V11. So far, so good!
Thanks for your hard work!
kevinnol said:
In the Recovery are 3 different profiles, when i choose as example smooth profile what changes are made ?
Looked into the i9000 thread but cant find the answer
Click to expand...
Click to collapse
when you choose smooth, almost each governor is using more agressive profiles for better performance. if you choose powersave, the same, but more power, and with normal, the default governor settings are applied
it's for those of you, who don't want to search and try own settings (or at least, to get an idea, how to change some things)
Testing this out with my previous settings from Glitch, so far so good at 117% LiveOC on 1GHz step.
Herp derp Captivate XDA Premium App.
Will this kernel support call recording from the line? Many people missed that feature from old android 2.2.1

[GUIDE] [DIY] Tweaking Voltages and Governors Using init.d Scripts

I am writing this guide to help you make your own init.d scripts which you can use to set voltages and fine tune governor settings at boot.
Part 1: Creating a return to stock flashable zip
Part 2: Creating a flashable zip to set a default governor
Part 3: Setting default CPU frequencies.
Part 4: Tweaking voltages
General Information on the smartassV2 governor
Part 5: Setting ideal sleep and wake frequencies for smartassV2
Part 6: Understanding max and min cpu load
Part 8: Setting CPU thresholds and ramp steps
Part 9: Up rate us and down rate us
Creating a return to stock flashable zip
I do not have any background in programming or engineering. Editing scripts is something I realized I could do after reading through the thread on the LeeDroid ROM.
I had been using apps to adjust voltage levels of the processor, and the settings would not stick past reboot. LeeDroid's post showed me how I could adjust "vdd_levels" in a different way: by editing a file in the system/etc/init.d setting of your phone.
I started by manually editing files using Root Explorer. The new settings would take effect on reboot. I recommend that you edit using editor in an Android app designed for the purpose, like Root Explorer. Editing Android text files with Windows notepad could remove UNIX coding.
Of course, a bad edit could result in a phone which would not boot or enter into boot loops. So if you plan to do this I recommend that you first create a return to stock zip.
If you have a zip which would restore the stock zip file that you plan to edit, at worst a bad setting creates a problem that can be fixed by a simple battery pull, and flashing the return to stock file.
So lets learn how to create a flashable zip with a return to stock file.
The file that needs to be edited for setting and tweaking governors and clocks speeds is normally:
1. 01sysctl
2. 07sysctl
3. 00start
4. Something else :silly:​A have created a blank template which you can edit and which you should download and edit as part of this tutorial.
DOWNLOAD THE ATTACHMENT (having dinner. feeding dog. will upload it after) .
1. After you download the attachment, unzip and lets start editing the files inside.
2. Open the folder returntostock-template and you will see two folders:
META-INF
system
3. First lets copy the file to plan to edit into the /returntostock-template/system/etc/init.d folder.
If you are planning to edit the system/etc/init.d/01sysctl file, copy 01sysctl and paste it in
/returntostock-template/system/etc/init.d/
When you flash the zip you are creating the contents of /returntostock-template/system/etc/init.d/ will be flashed into /system/etc/init.d/
4. No, go into the META-INF folder.
5. Open the file called CERT.SF with a text editor. It should looks something like this:
Signature-Version: 1.0
Created-By: 1.0 (Android SignApk)
SHA1-Digest-Manifest: UX+RVULxNdXlqI1RzwHfpVdI82E=
Name: META-INF/com/google/android/updater-script
SHA1-Digest: tVgqIpMRtv5B/PDrjuBV53KwFaE=
Name: system/etc/init.d/01sysctl
SHA1-Digest: ldESPD5zXoMgc1LeEoJzmQR64XI=
Name: META-INF/com/google/android/update-binary
SHA1-Digest: bgbIMYDdOmTgqY3FnKD5cRyGkrw=
Click to expand...
Click to collapse
I highlighted in bold the line you may have to change. If you are editing the 01sysctl file than you can leave it as is. If you are editing the 00start file you can change the line to read:
Name: system/etc/init.d/00start
Click to expand...
Click to collapse
6. Next, open the file called MANIFEST.MF. It should looks something like this:
Manifest-Version: 1.0
Created-By: 1.0 (Android SignApk)
Name: META-INF/com/google/android/updater-script
SHA1-Digest: buU2q9y9m+br7uS7p3pPrQBNAvs=
Name: system/etc/init.d/01sysctl
SHA1-Digest: vdvxtL6XYfchsrXx3EBnG+qNyXE=
Name: META-INF/com/google/android/update-binary
SHA1-Digest: lW3X0T93MyGESji9tYbY+94o+jo=
Click to expand...
Click to collapse
I highlighted in bold the line you may have to change. If you are editing the 01sysctl file than you can leave it as is. If you are editing the 00start file you can change the line to read:
Name: system/etc/init.d/00start
Click to expand...
Click to collapse
7. THIS LAST STEP IS OPTIONAL, BUT IT IS NICE TO PERSONALIZE YOUR WORK. Next, go into the com folder, and than the google folder and finally the android folder.
8. Open the file called updater-script with a text editor. What you should see should look like this:
#
# Updater-script
#
ui_print("Flashing process for NAME OF ROM HERE");
ui_print(">>>Mounting partitions");
assert(mount("ext3", "EMMC", "/dev/block/mmcblk0p25", "/system") || mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/system"));
ui_print(">>>Writing System");
package_extract_dir("system", "/system");
ui_print(">>>Unmounting partitions");
unmount("/system");
ui_print("Done!");
Click to expand...
Click to collapse
You can change the NAME OF ROM HERE to anything you like. It will be displayed when the script is flashed.
9. Okay, were almost done. You can rename the folder to returntostock-template to something which will remind you what it is like CoolICSROM-returntostock or anything else you like.
10. Zip the file, and it is ready to use.
Now lets make another flashable zip, this time to set a new default governor.
Creating a flashable zip to set a default governor
Having learned how to make a flashable zip from this post, we now have the tool to deploy the payload into you ROM from recovery. So lets deploy something :laugh: Lets make a flashable zip to set the governor.
1. Okay, lets unzip the return to stock zip you made. In our first guide we called it CoolICSROM-returntostock.zip. It will unzip into a folder of the name of your file. In our example the folder will be named CoolICSROM-returntostock.
2. Lets rename the folder boonkeat8-governortweak, or anything else you want.
3. Now, these scripts are really more like hidden settings. They do not add any functionality to your ROM, but allow to enable things already there. So first we should check what governors are supported by you ROM.
Browse to > /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
You should see something like this
convervative interactive ondemand ondemandX lionheart lionheartX smartassV2​
Click to expand...
Click to collapse
What you see listed is what is available.
4. In order to enable a governor as default, you have to write this line into the 01syscl (or 00start or other file depending on the ROM). Let's say we want to use the smartassV2 governor.
This is the line of code you need to write to enable it.
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
5. Lets go into the boonkeat8-governortweak and browse to /system/etc/init.d folder. Open the 01sysctl, 00start or other file you place in there with a text editor.
6. The typical 01sysctl file looks something like this:
#!/system/bin/sh
# - sysctl -p​
Click to expand...
Click to collapse
7. So lets just insert the line so it looks like this:
#!/system/bin/sh
# - sysctl -p
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
8. Zip the boonkeat8-governortweak folder, and you now have a flashable zip to enable the smartassV2 governor.
xxxxxxxxxxxxxxxxx
The 00start start file in a ROM like TrickDroid looks more daunting.
#!/system/bin/sh
SCHEDULER=noop
echo $SCHEDULER > /sys/block/mtdblock25/queue/scheduler
echo $SCHEDULER > /sys/block/mtdblock26/queue/scheduler
echo $SCHEDULER > /sys/block/mtdblock27/queue/scheduler
echo $SCHEDULER > /sys/block/mmcblk1/queue/scheduler
echo 1 > /sys/block/mmcblk1/queue/rotational
for i in 1 2 3 4 5
do
echo 0 > /sys/block/mtdblock$i/queue/rotational
done
sync
echo "3" > /proc/sys/vm/drop_caches
setprop dalvik.vm.execution-mode int:fast​
Click to expand...
Click to collapse
But you just to the same thing. Insert the line of code.
#!/system/bin/sh
SCHEDULER=noop
echo $SCHEDULER > /sys/block/mtdblock25/queue/scheduler
echo $SCHEDULER > /sys/block/mtdblock26/queue/scheduler
echo $SCHEDULER > /sys/block/mtdblock27/queue/scheduler
echo $SCHEDULER > /sys/block/mmcblk1/queue/scheduler
echo 1 > /sys/block/mmcblk1/queue/rotational
for i in 1 2 3 4 5
do
echo 0 > /sys/block/mtdblock$i/queue/rotational
done
sync
echo "3" > /proc/sys/vm/drop_caches
setprop dalvik.vm.execution-mode int:fast
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
Lets mode on to setting default CPU frequencies.
Setting default CPU frequencies
I really hope someone is reading all this.
Okay, having learned how to set the default governor, lets move on to default processor speeds.
Right now our init.d configuration script looks something like this:
#!/system/bin/sh
# - sysctl -p
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
In order to change the default processor frequency, we have to first find out what is available.
You can do this by opening the scaling_available_frequencies file located in /sys/devices/system/cpu/cpu0/cpufreq.
The contents should look something like this:
122060 245760 368640 768000 806400 1024000 1200000 1401600 1497600 1708800 1804800 1900800 2016000​
Click to expand...
Click to collapse
245760 = 245 MHz
368640 = 368 MHz
768000 = 768 MHz
806400 = 806 MHz
1024000 = 1024 MHz
...and so on
REMEMBER, YOU ONLY NEED TO DO THIS IF YOU WANT TO CHANGE THE DEFAUL PROCESSOR SPEEDS.
To find out the the default processor speeds browse to:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq - This tells you what the current maximum processor frequency is.
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - This tells you what the current minimum processor frequency is.
The command to change the processor speeds are:
echo 'PROCESSOR SPEED HERE' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 'PROCESSOR SPEED HERE' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
So if we wanted to modify our current project to have a maximum speed of 1200 MHz, and a minimum speed of 368 MHz, we would modify our current file to look like this:
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo '368640' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
If you only want to change the maximum frequency than just enter the line for that:
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
Now, lets mess with voltages.
Changing voltages
Okay, we have learned how to make a flashable zip, change the default governor and change the default frequencies.
Before we get into how to adjust default voltages, one thing you should take into consideration is the most ROM's already have HTC default voltages for the Desire HD tweaked for efficiency.
HTC default voltages
245 MHz - 1000 vdd
422 MHz - 1025 vdd
806 MHz - 1100 vdd
1024 MHz - 1200 vdd
Source: LeeDrOiD HD Thread.
Typical stock voltage for most custom ROM's
245 MHz - 875-925 vdd
422 MHz - 900-950 vdd
806 MHz - 10125-1075 vdd
1024 MHz - 1050-1100 vdd
Given this situation reducing voltage is not all that important these days.
Anyway, lets discuss how to do it, and we can engage in discussions, and get feedbacks from users on the matter.
Checking your ROM's default voltages
Okay, lets fire up you file manager and browse to /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Image of vdd_levels file from ARHD 6.3.3.
Image of vdd_levels file from Blackout ICS v.3.1.1 modified with Blackout-smartassV2-1GHz-c3.zip.
Changing the voltage
The command for changing voltage is:
echo 'FREQUENCY VDD' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
When running the 1200 MHz speed I find my phone can run this speed as low as 1100MHz. I learned this while running ARHD6.3.3.
In order to set that voltage you would need this command:
echo '1200000 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
Adding it to our current project
Our current project looks something like this:
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo '368640' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo '1200000 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
Thats all there is too it.
Now lets go and tweak smartassV2.
General information on the smartassV2 governor
Governors are of all types generally to be based on one of two sources: ondemand and conservative.
smartassV2 for example is based on ondemand.
Other popular governors like lionheartX are based on the conservative governor.
Okay, lets start with smartassV2
General info:
SmartassV2 "has an 'ideal' frequency which it will quickly ramp up to, then more slowly ramp up once past it, and vice-versa for down-ramping. A separate "ideal" frequency is used when the screen is off."
Click to expand...
Click to collapse
(Source)
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
Click to expand...
Click to collapse
(Source).
Tunables (Source)
awake_ideal_freq
The "ideal" frequency to use when awake. The governor will ramp up faster towards the ideal frequency and slower after it has passed it. Similarly, lowering the frequency towards the ideal frequency is faster than below it.
sleep_ideal_freq
The "ideal" frequency to use when suspended. When set to 0, the governor will not track the suspended state (meaning that practically when sleep_ideal_freq =0 the awake_ideal_freq is used also when suspended).
sleep_wakeup_freq
The frequency to set when waking up from sleep.When sleep_ideal_freq=0 this will have no effect.
ramp_up_step
Frequency delta 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.
ramp_down_step
Frequency delta when ramping down below the ideal freqeuncy. Zero disables and will calculate ramp down according to load heuristic. When above the ideal freqeuncy we always ramp down to the ideal freq.
max_cpu_load
CPU freq will be increased if measured load > max_cpu_load;
min_cpu_load
CPU freq will be decreased if measured load < min_cpu_load;
up_rate_us
The minimum amount of time to spend at a frequency before we can ramp up. Notice we ignore this when we are below the ideal frequency.
down_rate_us
The minimum amount of time to spend at a frequency before we can ramp down. Notice we ignore this when we are above the ideal frequency.
sample_rate_jiffies
Sampling rate, I highly recommend to leave it at 2.
Click to expand...
Click to collapse
Setting ideal sleep and wake frequencies for smartassV2.
Wake, sleep and deepsleep
Your basic governor is on demand and it runs your processor from the slowest speed to the fastest speed, depending on "need". With a HTC Desire HD, typically the slow speed for a ROM at stock settings is around 245MHz and the fastest is at about 1024 MHz.
Need is determined by something called the max_cpu_load setting. But we will get back to the in a later post.
What differentiates smartassV2 is the addition of two settings to your basic ondemand governor:
awake_ideal_frequency
sleep_ideal_frequency
You will find the smartassV2 settings in /sys/devices/system/cpu/cpu0/cpufreq/smartass
awake_ideal_frequency - This setting will influence processor behavior when screen is on.
sleep_ideal_frequency - This setting will influence processor behavior when screen is off. Basically, when the phone is working in the background.
Deep sleep - The kernel is in charge.
Speed brakes
So lest say, maximum cpu frequency is set to 1024 MHz. This is the fastest the phone will run.
Typically, awake_ideal_frequency will be set at 800000 (meaning 800 MHz). This is the speed which the phone will ramp up fast to. After this the processor will still speed up, but more conservatively.
So lets say the ROM we are using has the following frequencies available:
245 - 368 - 768 - 806 - 1024 MHz.
When the screen is awake, the phone will go from 245 MHz to 368 MHz to 768 MHz and 806 MHz "fast"... but will take more time before deciding to go to 1024 MHz. Think of it as a setting which starts to apply brakes to the CPU's and try to slow down the CPU's progress.
So basically the lower the awake_ideal_frequency the more conservative the processor behavior will be. This should result in better battery life, but also poorer performance.
sleep_ideal_frequency
sleep_ideal_frequency works the same way, but it replaces the awake_ideal_frequency when the screen if off,
Typical sleep_ideal_frequency is between 200000 to 400000 (200 MHz to 400 MHz) so it applies the brakes sooner.
This is based on the theory that while the screen if off, even if it is working, it needs less power.
Back to are project
We left our project looking like this in the previous post:
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo '368640' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo '1200000 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor​
Click to expand...
Click to collapse
The command for setting awake_ideal_freq and sleep_ideal_freq are as follows:
echo 'FREQUENCY' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/awake_ideal_freq
echo 'FREQUENCY' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_ideal_freq
​
Now lets say we wanted to leave out awake ideal frequency at ROM default of 800 MHz, but wanted to make the sleep ideal frequency higher, to 368 MHz from 245 mHz. We could do it two ways.
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo '368640' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo '1200000 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo '400000' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_ideal_freq​
Click to expand...
Click to collapse
You could also put the exact frequency:
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo '368640' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo '1200000 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo '368640' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_ideal_freq​
Click to expand...
Click to collapse
Both will have the same effect.
TAKE NOTE OF THE ORDER, YOU MUST ENABLE SMARTASS FIRST, BEFORE TWEAKING ITS SETTINGS SO PUT THE LINE TO ENABLE SMARTASSV2 BEFORE THE CODES TWEAKING IT
Okay, lets move on to CPU load.
Understanding max and min cpu load
In the previous part of this guide we learned who to set the ideal wake and sleep levels.
Lets move on to another pair of important tunables:
max_cpu_load
min_cpu_load
max/min cpu load is set at a % figure.
For if example max_cpu_load is set at "55", than when the average processor usage is over 55% for a given period of time the processor will speed up. min_cpu_load is the figure that governs when the processor will slow down.
Before talking about how to do this, lets do that math since these two figures have to be set in a mathematically correct way.
A lot of popular ROM's these days have very few choices in terms of clock speeds:
122 MHz
245 MHz
368 MHz
768 MHz
806 MHz
1024 MHz
and so on.​
Click to expand...
Click to collapse
These are the clock speeds on the Blackout ICS ROM and other ROM's based on the Virtuous Kernel. You can find the available clock speeds for a ROM by looking at the sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies. In that file you will see clockspeeds in Hertz rather than MHz so 122000 = 122 mHz.
The Blackoyr ROM also sets:
max_cpu_load = 55
min_cpu_load = 25
ramp_up_step = 200000
ramp_down_step = 300000
Click to expand...
Click to collapse
Ramp up and ramp down steps are also important to how this all works, and can be adjusted, but lets leave that to the next part of this guide.
Slowing down
Using the setting in the Blackout ROM, this is how min_cpu_load works
Okay, all this is a bit confusing (or at least I am having a hard time writing it) but let me see if I can explain it by example. Lets says you just completed a heavy task and the phone is running at full speed (1024 MHz be default). The phone will continue to run at this speed, until the average processor use is below min_cpu_load:
1024 x 0.25 = 256 MHz​
Click to expand...
Click to collapse
So the processor goes down from 1024 MHz by 300 MHz (the ramp down speed) to 768 MHz. If processor use goes to below 256 MHz, the processor will ramp down to 768 MHz.
One at 768 MHz, the governor will compute again:
768 x 0.25 = 192 MHz​
Click to expand...
Click to collapse
If the average processor speed is less than 192 MHz, is will continue to slow down. If greater than 192 MHz it will stay at 768 MHz.
Speeding up
With the phone now running 768 MHz, if the load goes higher the max_cpu_load than the processor will speed up. At 768 MHz the max_cpu_load is 422 MHz:
768 x 0.55 = 422 MHz
Click to expand...
Click to collapse
Logical values
When setting this two figures, it is important that:
cpu frequency x cpu_min_load for the higher speed
BE HIGHER THAN
cpu frequency x x cpu_max_load for the lower speed
Click to expand...
Click to collapse
Lets say we set:
max_cpu_load = 55
min_cpu_load = 45​
Click to expand...
Click to collapse
Using the the new figures, we just completed another heavy task and the phone is again running at full speed (1024 MHz be default). The phone will continue to run at this speed, until the average processor use is below min_cpu_load:
1024 x 0.45 = 461 MHz​
Click to expand...
Click to collapse
Lets say the average processor speed is at 450 MHz, so the processor scales down to 768 MHz.
If processor use remain continues at 450 MHz, the governor will compute again:
768 x 0.45 = 345 MHz​
Click to expand...
Click to collapse
Since 400 MHz is higher than 345 MHz. The processor stays at 768MHz and the governor stops ramping down. But the governor is also checking if it should speed up:
768 x 0.55 = 422 MHz​
Click to expand...
Click to collapse
Since average speed is over 422 MHz, the processor speeds up back to 1024 MHz. And when there, it will ramps down again.
In sum:
max_cpu_load = 55
min_cpu_load = 45
Are not good values when use with a ROM where the available frequencies are far apart like the ones on the Blackout ROM. The min_cpu_load it too close to max_cpu_load.
Before we set the max_cpu_load and min_cpu_load in our current project, we should also discuss ramp_up and ramp_down steps.
Setting max_cpu_load, min_cpu_load, ramp_up_step and ramp_down_step.
Previous post was on setting cpu thresholds.
Lets go back to our previous example:
CPU Frequencies:
122 MHz
245 MHz
368 MHz
768 MHz
806 MHz
1024 MHz
max_cpu_load = 55
min_cpu_load = 25
ramp_up_step = 200000
ramp_down_step = 300000​
Click to expand...
Click to collapse
Ramp up
Starting at 245 MHz, with these settings when the CPU use hits greater than 55%, the processor will ramp up 200000 Hz or 200 MHz.
From 245 MHz to 445 MHz. Since there is no 445 MHz setting, it will go to the closest which is 368 MHz.
From 368 MHz it will ramp up to 568 MHz. There being no 568 MHz frequency it will go to 768 MHz.
From 768 MHz it will ramp up to 968 MHz. There being no 986 MHz frequency it will go to 1024 MHz.
Click to expand...
Click to collapse
Ramp down
Starting at 1024 MHz, with these settings, when the CPU use goes below 25%, the processor will ramp down 300000 Hz or 300 MHz.
From 1024 MHz to 768 MHz.
From 768 MHz it will ramp up to 368 MHz.
From 368 MHz it will ramp up to 245 MHz.
Click to expand...
Click to collapse
In computing you max_cpu_load and min_cpu_load, you should consider the settings to determine which speeds you should use to calculate:
cpu frequency x cpu_min_load for the higher speed
BE HIGHER THAN
cpu frequency x x cpu_max_load for the lower speed​
Click to expand...
Click to collapse
Commands to set max_cpu_load, min_cpu_load, ramp_up_step and ramp_down_step.
The commands are:
echo '%' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/max_cpu_load
echo '%' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/min_cpu_load
echo 'HERTZ' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_up_step
echo 'HERTZ' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_down_step
Going back to our current project the settings could look like this:
#!/system/bin/sh
# - sysctl -p
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo '368640' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo '1200000 1100' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo '400000' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_ideal_freq
echo '75' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/max_cpu_load
echo '30' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/min_cpu_load
echo '150000' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_up_step
echo '200000' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_down_step​
Click to expand...
Click to collapse
Next lets us go to up_rate_us and down_rate_us.
up_rate_us/down_rate_us
The up_rate_us setting dictates how much time the phone will stay at a frequency before ramping up. It only applies after reaching the awake ideal frequency when the screen is on, and the sleep ideal frequency when the screen is off.
To understand this better, let us assume the following settings:
CPU Frequency: 245 MHz to 1200 MHz
Available Frequencies: 245 > 368 > 806 > 1024 > 1200 MHz
Awake ideal frequency: 1024 MHz
Sleep ideal frequency: 368 MHz
Max CPU Load: 60%
Min CPU Load: 25%​
Click to expand...
Click to collapse
If the processor is running a 245 MHz, and detects a load it will go from 245 MHz to 368 MHz to 768 MHz to 1024 MHz as soon as CPU load hits 60%. When it hits the awake ideal frequency of 1024 MHz it will not go up to 1200 MHz even if the CPU usage hits 60% unless it has spent as least X number of microseconds at 1024 mHz. This X number of seconds is the up_rate_us setting.
up_rate_us is set in microseconds. For example if, up_rate_us is set at 48000 (48,000 microseconds = 0.048 seconds).
In our example, the up_rate_us setting keeps the phone at 1024 MHz for at least 0.048 seconds before ramping up to 1200 MHz. The higher the setting, the more conservative the processors behavior will be.
down_rate_us works in the same way, but it reverse. If forces the cpu to stay at a frequency for a given number of milliseconds before ramping down WHEN BELOW THE IDEAL FREQUENCY.
Given out example. With the CPU at 1200 mHz. Once CPU use hits 25%, it will ramp down immediately. Once it hits 1024 mHz or lower, it will ramp down only after it has spent as least X number of microseconds at a frequency. The lower the down_rate_us setting, the more conservative the processors behavior will be.
Command to set up_rate_us/down_rate_us
echo 'MICROSECONDS' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/up_rate_us
echo 'MICROSECONDS' > /sys/devices/system/cpu/cpu0/cpufreq/smartass/down_rate_us
I have not spent much time experimenting with these settings.
thanks for your good work:
but it's seem you are wrong when mentioned: "You will find the smartassV2 settings in /sys/devices/system/cpu/cpu0/cpufreq/smartass"
actually its locaton will be /sys/devices/system/cpu/cpufreq/smartass
another question is what's about value : /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq
mind it sets to 9999999, very strange
So, I made this script
68ioshcedinit:
Code:
#!/system/bin/sh
# - sysctl -p
echo "noop" > /sys/block/mmcblk0/queue/scheduler;
echo 'smartassV2' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo '1200000' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo '245760' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo '245760' > /sys/devices/system/cpu/cpufreq/smartass/sleep_ideal_freq;
echo '768000' > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq;
echo '806400' > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq;
echo '55' > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load;
echo '30' > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load;
echo '200000' > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step;
echo '300000' > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step;
Sorry, cpu0 is a typo. A bit too much cut and paste on my part.
9999999 basically tells it to ignore that setting. If you place a valid frequency in that setting, the processor will jump to that speed when you wake the phone.
Sent from my Desire HD using xda premium
Thanks a lot for this guide. I didn't want an app to control my kernel as it feels like it slows the phone down (maybe placebo) I made a script to set my Gov, CPU max/min and I UV all of my CPU freq all worked perfect. I didn't make a .zip I just made the file and copied into the init d folder and set permissions. One thing I did do wrong though was I didn't convert the file so it didn't work, I found this in another guide ''Edit-->EOL Conversion-->UNIX/OSX Format'' when I started notepad ++ it wasn't automatically set to this. Hope this helps someone and thanks a lot for this, now I just need to decide if I was a custom MM ROM or stock MM with xposed

[ROM][JB] Slim-JB

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download here : SlimJB
If you get su lost message, just reboot to cwm and again reboot to system. It will fix the problem.
So what is my rom ?
Basically tweaked for performance and battery
Stock based (I love stock UI)
Custom kernel tweaked for balance between performance and battery
Stripped un-needed stuff from the kernel. Small size
Custom SlimJB scripts to further enhance the rom
Comes with OTA update feature
Find out other features..
How to install :
The normal method
Download, place in sdcard. Aroma is self- explanatory..
In cwm, mount all partitions. Somehow the script doesn't do it..
Just make sure you wipe cache and do a factory reset before installation.
In aroma, choose installation method as default
How to use Goo Manager :
Goo Manager will automatically scan for updates on every boot and every 24 hours. You can change this in the app settings.
To update using Goo Manager, just click on the notification. The download will be automatically started. You can also see the changelog in the app.
To manually check for updates, open the app and click on check for updates.
DO NOT INSTALL OPEN RECOVERY. If the app asks you, just choose that you have a recovery installed.
Edit : Since our param driver is bugged, goo manager won't be able to install the update. You will have to manually install it.
( Kernel Features )
fs: CIFS module
fs: Fsync control (Combined dyn fsync control)
fs: Mount noatime and nodiratime by defualt [franciscofranco]
fs/aio: Asynchronous io performance improved
mm: SLUB memory allocator
arm: ThumbEE
arm: Optimzed rwsem algorithm [ezekeel]
arm: Remove old version sha1
arm/vfp: Build with neon
arm/crypto: ARM AES and SHA-1 crypto
arm/topology: Linaro lastest patches
ab8500_asoc: Sound control
ab8500_bm: Charger control
ab8500_chargalg: Charge cycle control
ab8500_chargalg: Real charged notification
lib: Optimzed CRC32 algorithm [ezekeel]
lib: GNU C version memcpy
net: More choices of TCP congestions
rcu: jRCU [Joe Korty]
swap: swap supports
zram:: zram supprots for android
mali: Utilization control
mali: PP scheduler tweakable
mali: PM sampling rate tweakable
mali: L2 cache max reads writable
mali: Disable mali state tracking
block: 8 io schedulers
snvet: Reduce the waketime 6s -> 1s
sched: Enable arch_power by default
sched: ARM multi-core schduler
debug: Remove Samsung debug code [Adi_Pat]
debug: Disable KGDB [Adi_Pat]
debug: Remove frame pointer [Adi_Pat]
debug: Fixed mismatches [Adi_Pat]
debug: Android logger as module (free 4mb RAM)
mxt224e: Sensitivity improved by defualt
mxt224e: Touch booster control
max224e: Touch sensitivity control
bcmdhd: PM_FAST by default
kernel:Lzop compression
ramdisk: Custom bootanimation supports [diego-ch,thank you!]
ramdisk: Lzop compression
ramdisk: Init.d scripts
ramdisk: ClockworkMod Recovery 6.0.2.8 [diego-ch]
ramdisk: T.W.R.P Recovery 2.4.4.0 [TeamWin]
cpufreq: 12 cpu governors
cpuidle: Deeper sleep state
makefile: Useful optimization flags
toolchain: Linaro GCC 4.6.2
How to tweak the kernel furthermore :
In short :
Same as CoCore E
In long :
Here are some intructions/tips about how to play with the kernel.
Terminal is needed.
If you want to change the values,it needs su permission.
If you get 'Permisson denied',you need su permisson.
You can cd to the folder first,then do echos.
( Boot time )
CoCore-E boots faster than stock normally.
How to check boottime?
* TWRP kernel boottime is longer(around 8000ms).Because of that big ramdisk!
( Bootanimation )
Put bootanimation.zip in /system/media/.
Recommend you changing the permission to 0666.
If there is no bootanimation.zip,kernel will show you Samsung's.
( CPU governors )
* OnDemand has been patched cpu idle detection
* PegasusQ is taken from SiyahKernel (new version)
* Personaly,I use PegasusQ/OnDemand(Q)/HotPlug
* To be honest,most of custom governors are based on ondemand/interactive
* OndemandQ is a new governor.It will hotplug cpu when screen turns off only.
* If you mind the battery life time,choose HotPlug.It hotplugs cpu frequently.
* Interactive updated to linux-android-3.4 [Thanks!Aditya!]
* Zzmoove is new version(0.3),i havent tested fully.
( IO schedulers )
* Please choose them by yourself
* Personaly.i use SIO.
( Deepest sleep state )
Stock deepest is 3.Now it is 4 by default.
Deepest supported is 5.
To change:
* PegasusQ(hotplug governors) works badly with 5
* OnDemand works well with 5
* Please note that it wont increase the using time but standby time.
To check the cpuidle state:
( zRAM SWAP )
[zRAM]
zRAM is optimized for Android.
It is not lazy anymore.
Using zRAM will take a little CPU,because it needs to compress/decompress memory.
Setup disksize first: (example: 96mb= 96×1024×1024)
* Lager size more RAM will be compressed.
Enable:
Code:
mkswap /dev/block/zram0
swapon /dev/block/zram0
To check how many does it use:
* You can get other info in its sysfs
[SWAP]
Format/resize your SdCard via computer first.
Enable:
( Init.d script )
Please install busybox in system first
I recommend you install busybox via apps
Create a new folder named 'init.d' in /system/etc
Set the permisson of init.d foler to 0777(rwxrwxrwx) (at least has read and exec permission)
Set the owner to 0.0 (root root)
Put some scripts (any name you like) in init.d folder with permisson 0777 (rwxrwxrwx) (at least has read and exec permission)
Scripts with right permisson will be runned when system boots.
( Charger control )
Please note that this control can damage your battery/phone.
If your battery/phone damaged,read the top of #1 post.
Lower current makes the charging longer,but protects battery.
Too high current can burn your battery!
I recommend you that dont set the max limited current over 900mA.
To change the AC max limited current: (range: 100 - 1100) (default: 600)
To change the USB max limited current: (range: 50 - 1100) (default: 500)
* Your values wont be applied immediately.They will be applied when plug charger.
* I recommend you input some values like 300,350,600...
* The value(s) that is not in range will be reverted to stock default value(s).
* Increase USB current properly can implement USB fast charging
To get the charging current:
When you plug charger:
( Charge cycle control )
To increase the recharge times:
(Default: 3)
* 5 is recommended.If you want more recharging.
* This probably can make phone charge deeper,do it once a month if you want.
( Real charged notification )
Well,please let me call it notification.
To be honest,it needs to check manually.
* You can use Rootexplorer to view this file.
* When it says "First full charging reached",then the UI should show you charged 100%
But it is not the real full charged.
* When it says it is the real full charged,you can unplug the charger.
* When you are charging and do a reboot will reset the counter.
* According to my experiments,it needs 1-2 hours to charge to real full.
( Sound control )
Please note that listening to too high volume music over 1 hour can damage your ears.
Or makes your speaker/headset overload.
(5.0+) Sound control has been enhanced.Please read it carefully.
Switch to sound control folder:
cd /sys/mo*/snd_soc*/p*
Use RootExplorer to view this folder,you will see a lot files.
Sound hacks wont take effects immediately.It depends on powering on/off ab8500 asoc.
Stop music for 5s to let ab8500 asoc shut down fully,then turn on music.
You need to enable XXXXX_con first,then tweak the XXXXX_bit.
After enabling XXXXX_con,it will be applied when codec powers on or it wont.
How do i check whether it has shuted down or not?
dmesg | grep codec
If you get "Disable ab850x",it has been powered off.
I will explain how to calculate the binay values below.
If we echo 0000 to something,system will consider it as 0.
But that doesnt matter.
'(default)' means that is my default setting in sound control.
[AnaGain3] (Headset audio path):
Ana stands for 'analong'.This is analong gain.
To enable control:
To tweak volume: [volume 0(default, +31dB) > 34 > 68(stock) > 85 > 87]
* Most values(except 0,34,68,85) will make the volume lost balance.
* If you hear too much noise with 0,34 is recommended.
* It is nice to use 0 with large speakers(audio output)
[HsXDigGain] (Headset Digital Gain)
HsL means left channel.HsR is the right.
To enable control:
To tweak:
* 0000: +8 dB gain (default)
* 0001: +7 dB gain
* ....: -1 dB step
* 0111: +1 dB gain
* 1000: 0 dB gain
* 1001 to 1111: -inf dB gain (mute)
* If you use +31 dB AnaGain3 + +8 dB DigGain,the result will higher than +39dB!
* Be careful,when the volume is too high,codec will power off automatically.
* Experience the differences between digital gain and analong gain by yourself.
[HsLowPow] (Headset low power mode)
This lowpow mode is enabled by driver normally.
If you want high performance audio instead of LPA(low power audio),
You can disable it.
To enable control:
To tweak:
* 0: Normal Operation (default)
* 1: Hs drivers in Low Power
[HsDacLowPow] (Headset DAC low power mode)
DAC is Digital-to-Analong Converter.
This lowpow mode is enabled by driver normally.
To enable control:
To tweak:
* 00: Normal Operation (default)
* 01: Hs DAC drivers in Low Power
* 10: Hs DAC in Low Power
* 11: Hs DAC and Hs DAC drivers in Low Power
[HsHP] (Headset high pass filter)
This high pass filter is enabled by driver normally.
If you want more low freq sound,disable it.
To enable control:
To tweak:
* 0: Headset high pass filter disabled (defualt)
* 1: Headset high pass filter enabled (offset cancellation enabled)
[ClassDDithHPGain]
ClassD is a kind of amplifier.
According to the documents,our ClassDs only relate to Handsfree(speaker).
To enable control:
To tweak:
* Gain control for the high pass component of dithering filter
* 0000: Minimum gain
* ....:
* 1010: Maximum gain (default)
[ClassDDithWGain]
* Gain control for the white component of dithering filter
* 0000: Minimum gain
* ......:
* 1010: Maximum gain
[ClassDHiVol]
This is a gain of speaker.But +2dB only.
echo 1 > classdhivol_con
Say 1(default) to enable:
* In fact,our speaker is right channel only!
[MicXGain] doesnt work...I will add more in the future.
How to calculate the binary values?
We use HsXDigGain as example.
The gain step is "+1".
In binary: So the values will like these:
0+1 = 1 | 0001: +7 dB
1+1 = 10 | 0010: +6 dB
10+1 = 11 | 0011: +5 dB
11+1 = 100 | 0100: +4 dB
..... | ......
[Experts!]:
This method can work on any ab850x codec platform!
Play music,reduce the volume.
Now we are going to edit the codec registers.
E.G:
AnaGain3:
HsDigGain: (left/right channel)
Disable all lowpow mode:
* These hacks will restore when codec power off.
( Touch Booster control )
What is touch booster?
It can jump the cpufreqs(in fact,not only cpufreqs) to high value when you touch to improve the experience of touching.
Disabling this can save some power.
To disable: (default: enable)
To change the boost freq: (default: 800000) (Vaild: 200000,400000,800000,1000000)
( Touch Sensitivity control )
If you play some games like Temple Run,higher sensitivity might help.
To change: (stock: 22) (default: 17) (range: >0)
* Lower value,higher sensitivity.
* Turn on/off screen to apply the changes
* Parameter "threshold" to check the changes
* When charging,the threshold will be forced replace by threshold_chrg
* With high sensitivity,your touches can be applied even screen coveres something.
( Fsync control )
To disable fsync: (0=disable 1=enable)
* Disabling fsync can improve io performace,
but it can make the data which hasnt been written lose when a sudden poweroff comes.
* Disabling fsync or enabling dyn_fsync will make param driver fail to store data
That means your "reboot recovery" will be failed.
To enable dynamic fsync:
* Dynamic fsync will sync all buffers when screen turns off,
* If there is a heavy io load,the screen might stick for seconds.
* This is an experiment feature.
( WiFi suspend pm control )
To enable: (default: disable)
* Enable=PM_FAST (Faster) Disable=PM_MAX (Powersave)
( Mali GPU )
Mali debug level
Disabling can speed up a bit
* Higher level,more messages will be printed in dmesg,system will slow down
Mali L2 max reads control: (Stock:28kb,Default:48kb(max))
* Some values will slow down graphics
* If not sure,keep default
Mali PM sampling rate: (Default: 1000ms)
Mali PP scheduler tweaks: (Default: disable)
* Enabling this,Some places will over ahead,choose by your self
Mali Utilization sampling rate: (Stock:500ms,Default:1000ms)
How often report a mali utilization.
* Keep this default if unsure.
Mali Utilization control
(Default: low_to_high 192 high_to_low 64)
This probably will relate to the smoothness.
Our driver will report a mali utilization frequently.
This utilization(range: 0~255) means the load of mali.
If utilization is bigger than low_to_high,driver will request higher hardware performance(highest APE/DDR OPP).
If utilization is smaller than high_to_low,the driver will store the requested OPP(uses low OPP).
OPP can be understood as freq simply.
To check mali utilization values:
Then you will see the utilization it reports.
When it says SIGNAL_HIGH,it will request highest OPP.
When it says SIGNAL_LOW,it will request lowest OPP.
Press Ctrl+C to stop printing.
In my Temple Run,it seldom reaches low_to_high(192).
That means you can reduce low_to_high to trigger higher OPP requirement.
For smoothness and less powersaving:
Set low_to_high between 100-192.
( TCP congestions )
Supported:
To check all the available options:
To change to other option:
* I use YeAh
* In fact,every congestion is disigned for different environments.
* Google to learn deeper!
( EGL Driver )
To remove sw egl driver:
Edit /system/lib/egl.cfg
To
* According to my feelings: after removing sw egl driver,UI is faster
( Service Mode )
In dialer, type:
Secret code:*#197328640*# (service mode)
Secret code:*#9900*# (SysDump)
In SysDump:
Disable fastdormancy might help 3G standby time (Depends on your mobile base station)
* Google to learn more
RAM DUMP is a debugger.Most of us wont use it.So disable it. (Tap it,every tap will make a reboot,until it shows you "Disable....",then tap disable,it is disabled)
* Google to learn more about secret code
( Multi-core scheduler )
What is it? How does it work?!
(Default: 2) (Echo 0/1/2)
0 : No power saving load balance.
1 : Fill one thread/core/package first for long running threads.
2 : Also bias task wakeups to semi-idle cpu package for power savings.
( Logcat )
Well,we have made android logger(logcat) as module to free more RAM.
Some guys request logcat.
Now we provide you a workaround:
Create a new init.d script:
Then you can use logcat command.
Almost tweaks will be restored to default after reboots.
So you can make your tweaks as init.d scripts to apply them when boots. :laugh::laugh::laugh:
Kernel How-To's :
( FAQ )
Q: What firmware does this kernel support?
A: All ROM bases on stock firmwares,all stock firmwares.
Q: Why my phone lags a lot!
A: Please check the cpu load.If it always goes very high,some apps are using cpu!And please check that you are not in PowerSaving mode.
Q: Why my phone lags after booting in some minutes?!
A: Media Scanner is running in the background. More media files(especially HD videos),more time it will take
Q: Why my phone cannot go to deep sleep when screen is off!!!
A: Fix it yourself. It is app(s) taking the wakelock. Not kernel.
Q: Do I need to wipe anything when flashing this kernel?
A: NO
Q: My phone rebooted suddenly!!! What can i do?!
A: Give me /proc/last_kmsg and logcat. Will try my best to fix.
Q: Hey!Your kernel has issue!No-fills CPU shows me a wrong freqs!Fix it!
A: This is NOT issue.Every I9070 kernel will have this problem.Because No-fills will show you Dynamic Min/Max scaling freqs,DVFS(dynamic voltage and frequency system) will adjust Min/Max freq according to system load.
Open SetCPU,it shows you real freqs.Or check sysfs directly.
How can i forget the credits...
Cocafe for the Cocore kang
Adi_Pat for misc support
Diego-ch for mental support
R_a_z_v_a_n for testing my script
Frapeti and Fedevd for motivating me
Callmeventus for the idea
Shaaan.. can i flash another kernel with this rom ?
Dikirim dari GT-I9070 memakai XDA Developer app
Great! Thanks for the ROM... List of features?
GaYoung28 said:
Shaaan.. can i flash another kernel with this rom ?
Dikirim dari GT-I9070 memakai XDA Developer app
Click to expand...
Click to collapse
Yeah. You can
Like this rom! Hope I can install it soon! P.s. Is it debloated?
Not really. Some useless apps have been removed though.
Next releases may have the option to select apps as per the user requirements while installing.
Nice! I wanna test!!!!
I'll try it and give you feedback
Does it have "ripple lockscreen mod"? Or can I install on it? Is it deoxeded?
R: [ROM][JB] Slim-JB
Great! Also i love stock ui =D
What about ram usage? Average free ram with 2-3 apps opened?
Thank you!
Inviato dal mio S Advance
Inviato dal mio S Advance
where his kennel
Jacopo97 said:
Does it have "ripple lockscreen mod"? Or can I install on it? Is it deoxeded?
Click to expand...
Click to collapse
Already has the ripple mod..
I do not respond to tech support via PM
Shaaan.. can i flash over other custom rom?
Dikirim dari GT-I9070 memakai XDA Developer app
So... What did u 'develop' in this?
Sent from my GT-I9070 using xda premium
R: [ROM][JB] Slim-JB
sameer4344 said:
So... What did u 'develop' in this?
Sent from my GT-I9070 using xda premium
Click to expand...
Click to collapse
He made a kernel and he tweaked a lot i think
Inviato dal mio GT-I9070 con Tapatalk 2

[GUIDE][NOOB-FRIENDLY]How to use dorimanx kernel - Stweaks Guide

DorimanX Stweaks Guide for the S2
Updated: 13/01/16
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Picture from DorimanX website​
Guides:​Installation
Initial Setup
Stweaks Basics
Stweaks Advanced
My setup & Troubleshooting
Credits list
Useful links:
DorimanX Official by DorimanX(ICS-->JB)
DorimanX Unofficial builds by Cybernetus, Computoncio and DorimanX(JB-->KK)
DorimanX KK Unofficial builds by gsstudios (4.4.x)
DorimanX LP/MM Unofficial builds by gsstudios (5.1.x/6.0.1)
DorimanX JB Unofficial builds by chhapil (4.1.x/STOCK JB)
DorimanX JB Unofficial builds by GreekDragon (4.1.x/STOCK JB)
General how to go on kernel tunables
CPU governors and I/O scheduler guide
Unofficial DorimanX by Cybernetus download(Recommended for 4.4.X KK)
Unofficial DorimanX by Computoncio download(Recommended for 4.X.X JB/STOCK JB)
Official DorimanX download(OK on stock 4.1.2 and below)
​
Which version to get?
So all goes like this:
Unofficial builds by gsstudios - Development stopped in 2016
12.x support = 5.1.x, 6.0.1 maliv3 only! LATEST: DorimanX 12.0 by gsstudios - ROMS include Cyanogenmod 13, Cyanogenmod 12.1
11.x support = 5.1.x maliv3 only! LATEST: DorimanX 11.0 by gsstudios - ROMS include Cyanogenmod 12.1
10.x support = 4.3.y, 4.4.y maliv3 only! LATEST: DorimanX 10.45 by gsstudios - ROMS include Slimsaber 4.4.4, SlimKK, CM11, Omni 4.4
9.x support = 4.1.y, 4.2.y, 4.3.y, 4.4.y maliv2 only! LATEST: DorimanX 9.45 by gsstudios - ROMS include CM10.1.3
8.x support = STOCK, 4.1.y, 4.2.y, 4.3.y, 4.4.y maliv1(STOCK) maliv2 all the rest! LATEST: DorimanX 8.45 by gsstudios - ROMS include Stock 4.1.2 JB, NeatROM, Omega ROM
Unofficial builds by chhapil - Development stopped in 2016
8.x support = STOCK, 4.1.y, 4.2.y, 4.3.y, 4.4.y maliv1(STOCK) maliv2 all the rest! LATEST: DorimanX 8.47 by chhapil - ROMS include Stock 4.1.2 JB, NeatROM, Omega ROM
Unofficial builds by GreekDragon - Development stopped in 2016
8.x support = STOCK, 4.1.y, 4.2.y, 4.3.y, 4.4.y maliv1(STOCK) maliv2 all the rest! LATEST: DorimanX 8.70 by GreekDragon - ROMS include Stock 4.1.2 JB, NeatROM, Omega ROM
Unofficial builds by Cybernetus and Computoncio- Development stopped in 2014
All unofficial kernels support 4.4.y ROMS!
10.x support = 4.3.y, 4.4.y maliv3 only! LATEST: DorimanX 10.44 v008 by Cybernetus - ROMS include Slimsaber 4.4.4, SlimKK, CM11, Omni 4.4
9.x support = 4.1.y, 4.2.y, 4.3.y, 4.4.y maliv2 only! LATEST: DorimanX 9.44 v005 by Computoncio - ROMS include CM10.1.3
8.x support = STOCK, 4.1.y, 4.2.y, 4.3.y, 4.4.y maliv1(STOCK) maliv2 all the rest! LATEST: DorimanX 8.44 v005 by Computoncio - ROMS include Stock 4.1.2 JB, NeatROM, Omega ROM
Official - Development stopped in 2013
9.x support = 4.1.y, 4.2.y, 4.3.y maliv2 only! LATEST: DorimanX 9.43 - ROMS include CM10.1.2
8.x support = STOCK, 4.1.y maliv2 only! LATEST: DorimanX 8.43 - ROMS include Stock 4.1.2
7.x support = STOCK, 4.1.y maliv1 only! LATEST: DorimanX 7.46 - ROMS include Stock 4.0.x, leaked 4.1.2
5.x support = 4.0.y, 4.1.2 no mali only! LATEST: DorimanX 5.92 - ROMS include Stock 4.0.x
mali = video driver (for new users that dont care to look for answers)
STOCK = Stock 4.1.2 Jellybean Update for s2
Click to expand...
Click to collapse
I've complete the basic guide on Stweaks. Now I have to start on the advanced guide!
I was looking at other device threads when I noticed that there was no guide explaining all of the things you can do in dorimanx. There were guides on how to tune other kernels but NOT dorimanX. This is well needed thread that is long overdue and should have been created ages ago. So please, be patient.
Changelog:
13/01/16:
- Added GreekDragon DorimanX JB builds into kernel list
05/05/15:
- Added a troubleshooting guide on dorimanx kernel and stweaks
- Improved kernel version guide (Added examples of ROMs)
26/04/15:
- Officially finished basic guide on Stweaks
- Overhaul of OP (Now there's a guide on what version to use)
25/04/15:
- Unofficially finished basic guide on Stweaks
Installation
I won't include a guide on how to root your phone or how to put the kernel onto your phone. I assume you already know how to root your phone.
Picture coming soon
Step 1:
Reboot your phone to recovery
Step 2
Select install zip
Step 3
Select the storage location
Step 4
Find DorimanX kernel zip
Step 5
Confirm to flash
Step 6
Let it finish flashing
Step 7
Reboot your phone to system
Initial Setup
When your phone is rebooting, you'll notice a loading bar under your phone's logo and then this screen will pop up:
No need to worry as that is the DorimanX boot/splash screen. If your phone can get past this and boot into your OS, congratulations. DorimanX has been successfully installed.
To double check if your kernel has changed, go to your phone's settings, about phone. Then scroll down until you see something similar to this:
Now lets go to the app drawer. You will see an app called Stweaks. This is the app you want to tweak DorimanX kernel.
Here is how the app looks like. It may be complicated for beginners but I will guide you through how to use it
Stweaks Basics
Note: This is the i9100 version of dorimanx stweaks. I will not make a guide for the newer dorimanx stweaks app since I don't have the LG G2! However, if someone can provide screenshots, I'm sure I can do something about it!
CPU
Boot CPU frequency:
The CPU frequency that your phone will run at while booting or at startup. Increase this for faster boot speed, decrease for better battery life and stability.
My Recommendation: Leave it to defaults
Boost CPU frequency:
The CPU frequency that your phone will run whenever there is a sharp increase in CPU load. Increase this for faster responsiveness, decrease for better battery life. Please note that you can't set this value higher than the max cpu frequency. It's COMMON-SENSE!
My Recommendation: Leave it to defaults
Max Normal Frequency:
The CPU frequency that your phone will run before going to max frequency. This won't do much to your phone's CPU frequency, so it's best to leave it to defaults unless underclocking.
My Recommendation: Leave it to defaults
Max OC Frequency:
The overall max CPU frequency your phone will run at. Increase this for better responsiveness and processing speed, decrease if you want better battery life.
My Recommendation: Leave it to defaults unless you want to overclock or underclock
Min Frequency:
The minimum CPU frequency your phone will run at. Increase this for better responsiveness and processing speed, decrease if you want better battery life.
My Recommendation: Leave it to defaults unless you want to overclock or underclock
CPU-VOLTAGE
This section of Stweaks allow you to undervolt and overvolt your CPU. Please note that undervolting (UV) your CPU will decrease phone stability if set too low, whereas overvolting (OV) will decrease your CPU's lifespan and generate more heat.
CPU Voltage main switch:
Ticking this enables set CPU voltages. If your phone reboots from instability, stweaks will most likely be resetted to protect your phone from any further problems.
Check CPU Voltage Group:
Using this button checks what CPU voltage group your CPU is using. The Galaxy S2 has 5 different CPU types around the world, the most common is number 3 and the most stable is number 4 and 5. Number 2 and 1 are old CPU types and need more voltage to be stable. If your CPU type is 1 or 2, don't UV much otherwise you'll get SODs. Remember that the higher the number, the more undervolt you can apply on your CPU. If you are downloading someone else's profile and they have a different CPU voltage type, try to avoid using it. Higher voltage require higher voltages to be stable, but at the cost of heat and battery life. Please be careful if you are considering to overclock your CPU!
If you want to undervolt, here are some safe voltages you can set (see link below), just set the sliders to the same voltages for the corresponding frequencies:
https://docs.google.com/spreadsheets/d/1MlV6Tbfo_7_QEUnTkfpdioSSPSDSWPJLRxL8Z00A8yA/edit?usp=sharing
CPU-TUNING (AWAKE)
Default CPU governor:
The default CPU governor when your phone is awake (screen is on). DorimanX kernel by default gives users an option to change to various governors such as HYPER, Ondemand and NeoX. Changing this will affect your phone's responsiveness and multitasking performance. For more information about governors, visit my guide: http://forum.xda-developers.com/general/general/ref-to-date-guide-cpu-governors-o-t3048957
My Recommendation: The default governor (HYPER for the i9100) is responsive and stable for everyday usage, you can change it if your want.
Hotplug_Enable:
The hotplugging governor for your phone. You can choose from Alucard hotplug, Intellihotplug, enabled auto and disabled.
My Recommendation: Leave it to defaults. Enabled Auto setting will select the best hotplugging governor for your device.
Gov Policy Install:
This applies all the changes to the CPU governor settings and tunables. It is required by the user to press this if they want to keep the CPU settings.
Up Threshold:
Measured as percentage, when load on CPU is equal or above this threshold, your CPU will scale up.
Lower value = early scale up, and vice versa. (Applies only to HYPER, Ondemand, Intellidemand, PegasusQ, Conservative, Sleepy and zzmanX)
Default value = 60%
My Recommendation: Change it to 70% for better balance between battery life while keeping good performance.
Up Threshold at min freq sleep:
This threshold is used as up threshold while sampling rate is at frequencies less than freq_for_responsiveness. Above that, normal up_threshold is used.
Lower value = early scale up, and vice versa. (Applies only to HYPER, Ondemand, PegasusQ)
Default value = 50%
My Recommendation: Leave to defaults
Sampling rate sleep:
This factor determines how often the governor should poll for CPU usage in terms of frequency and load percentage to make scaling decisions.
Lower value = early scale up, and vice versa. (Applies only to HYPER, Ondemand, Intellidemand, PegasusQ, Conservative, Nightmare, Darkness Sleepy and zzmanX)
Default value = 60000uS
My Recommendation: Leave to defaults
Freq for responsiveness sleep
Long story short, this is setting is the frequency before the CPU goes to lower frequencies. It prevents any lag spikes from happening.
Lower value = More battery life, but more lags! (Applies only to HYPER, PegasusQ and Nightmare)
Default value = 400000kHz
My Recommendation: Leave to defaults
Down threshold sleep:
This is the same as the up_threshold but for the opposite direction.
Lower value = Frequencies reduced faster, and vise versa. (Applies only to HYPER, Ondemand, Intellidemand, PegasusQ, Conservative, Nightmare, Darkness Sleepy and zzmanX)
Default value = 30%
My Recommendation: Leave to defaults
CPU-TUNING (SLEEP)
Settings are pretty much the same as the awake CPU governor settings, but there are slight changes to the CPU governor tunables (more info on that later).
Deep-Sleep CPU governor:
The default CPU governor when your phone is in deep sleep or standby (screen is off). DorimanX kernel by default gives users an option to change to various governors such as HYPER, Ondemand and NeoX. Changing this will affect battery life and stability. For more information about governors, visit my guide: http://forum.xda-developers.com/general/general/ref-to-date-guide-cpu-governors-o-t3048957
My Recommendation: The default governor (Ondemand for the i9100) is responsive and stable for everyday usage, you can change it if your want.
IO
Kilobytes To Read-Ahead:
This only applies to the external sd card. This setting determines the kilobytes to read-ahead for your external sd card. Changing this will affect the transfer speeds to your phone's external sd card.
My Recommendation: Leave it to defaults. Auto setting will select the best setting for your device.
Default Awake IO scheduler:
This will set the default IO scheduler when your phone is awake (screen-on). There are many IO schedulers included with dorimanX kernels such as SIO, ZEN, BFQ and CFQ. Changing this will affect transfer speeds, phone responsiveness and load times. For more information about IO schedulers, visit my guide here: http://forum.xda-developers.com/general/general/ref-to-date-guide-cpu-governors-o-t3048957
My Recommendation: You can leave it to the default IO scheduler. I'm sure that the scheduler dorimanX chooses is stable, so if you don't know much about IO schedulers, leave it to defaults. However, I do recommend changing it to a simpler scheduler such as SIO and ZEN which have low overheads and less IO lantency.
Standby and Deepsleep IO scheduler:
The default IO scheduler when your phone is on standby or in deepsleep (screen off).
My Recommendation: Keep it the same as the awake IO scheduler. You can make it different from the awake scheduler if you really want to (but I don't recommend this).
Memory
AUTO OOM
Stands for Automatic low memory management, this allows the low memory management settings to be applied automatically or to take effect on your phone.
Default: Ticked
My Recommendation: Keep it ticked.
OOM Level Screen ON
The setting for the level of low memory management when screen is on. More aggressive settings leads to more free RAM but more killed apps.
Default: Aggressive
My Recommendation: Change it to medium as I believe it's the sweet spot for our phone.
OOM Level Screen OFF
The setting for the level of low memory management when screen is off. Same scenario applies where more aggressive settings leads to more free RAM but more killed apps.
Default: Medium
My Recommendation: Leave to defaults.
GPU
VPLL MODE
Ticking this box allows users to overclock the gpu even further than the default allowed frequencies. Please note that higher frequencies need more voltage, but there is the risk of damaging your GPU if too excessive.
Default: Unticked
My Recommendation: Keep this unticked. This settings is for the advanced overclockers and and tweakaholics. It is too risky keeping this enabled
GPU utilization timeout
This settings changes the CPU utilization timeout calculation. Basically this tunes the ramp up aggresiveness for the GPU, much like the CPU thresholds. Smaller values give faster GPU response but more battery drainage and vice versa.
Default: 400MSec
My Recommendation: Keep to default value.
GPU frequency steps
Dorimanx Kernel includes 5 GPU steps. These steps allow the GPU to scale frequencies efficiently and is originally made to save battery when not busy.
My Recommendation: Keep to default values unless you want to overclock.
GPU voltage steps
Complementing the frequencies, these settings are the GPU voltages for each step. Much like CPU voltages, settings these values too high will result in damage to the GPU, while not having enough voltage will result in instability.
My Recommendation: Keep to default values unless you want to overclock.
Screen
Min BL
Stands for minimum brightness level. Higher value will result in staying in the lowest brightness level for brighter conditions.
Default: 30
My Recommendation: Keep to default values.
Min Gamma
The setting to adjust minimum brightness level.
Default: 1
My Recommendation: Keep to default values.
Max Gamma
The setting to adjust minimum brightness level.
Default: 23
My Recommendation: Keep to default values.
Other settings will be explained in advanced guide!
Sound
Headphone Amplifier:
This setting allows you to adjust the headphone amplification level. Increase this if you want your headphones to sound louder.
My Recommendation: Keep to Disabled or Reset unless you want to boost headphone volume. I don't really recommend increasing this value.
Volume levels and Gain Controls:
These settings should be pretty straightforward, they're clearly labeled. Increase these values to boost the recording/playback volumes.
My Recommendation: Keep values to 0dB unless you want to boost headphone volume. I don't personally increase these values.
BLN
BLN stands for Backlight notification, meaning that your phone's buttons will light up whenever your phone gets a notification.
BLN
Tick it to enable Backlight notification. Please note that BLN will increase your phone's battery drainage when enabled.
My Recommendation: I don't personally enable BLN. Enable it if you want to.
BLN effect
This setting will set LED behavior for BLN, if BLNWW (BLN without wakelock, without getting CPU out of deep sleep) is on, the effect can only be steady. Options include steady, breathing and blinking.
My Recommendation: I don't personally enable BLN. Enable it if you want to.
Notification Timeout
This setting determines how long the Backlight Notification will stay on for. Time ranges from never to 2 hours.
My Recommendation: I don't personally enable BLN. But keeping it to a shorter value will save you battery.
Force LEDS disabled
The title says it all, forces your touch LEDs off if enabled.
My Recommendation: I don't personally enable BLN. Change the settings if you need this function
LED Timeout
This setting determines how long your phone's touch LEDs will light up when touched or when using touch screen.
Default value = 3 sec
My Recommendation: I don't personally enable BLN. Change the settings if you need this function
BLNWW
BLN Without Wakelock. This is a more battery efficient BLN but has less features than normal BLN. Enabling this (while BLN is also enabled) will let the CPU continue to sleep during BLN and save battery.
Default value = Ticked
My Recommendation: I don't personally enable BLN. Tick the setting if you need this function
The rest of the BLN settings should be pretty straightforward
Other
DorimanX has included scripts in his kernel that can optimize the phone by during certain conditions(time) or they can be applied straight away. The settings should be well explained anyway or straightforward.
Cron task main switch
Enable this to enable all set tasks. You need to enable this otherwise the set tasks will not be done!
My Recommendation: I don't personally enable Cron. Tick the setting if you need this function
Cron task main switch
Press this to test if the Cron task service is online or not. If the service is offline and you've enabled cron, the your ROM needs to be updated. (Busybox out of date)
Cron reset
Press this button to reset the scripts and jobs from kernel and to refresh the configuration. This will clear all your custom changes.
Tweaks
Cortexbrain is a script created by DorimanX that can manipulate many kernel settings based on chosen Stweaks profiles and settings and on screen state. It is so useful that the kernel enables it as default.
Cortexbrain-Background-Process
Enables or Disables the Cortexbrain background process.
Default: Enabled
My Recommendation: Leave it to enabled!
Check Background-Process
Checkes whether the Cortexbrain background process is running or not.
Android logger control
Controls what you can see in android logcat.
Default: AUTO
My Recommendation: Leave it to AUTO!
Modules will covered in advanced guide
Profiles
Here is the menu you want to manage all of the custom profiles available on stweaks
Profile Check:
Checks what profile you are currently running. By default, dorimanX kernel uses the default profile, and all changes will be saved there.
Profiles:
Include:
- Extreme battery
- Battery
- Default (Default)
- Performance
- Extreme Performance
I don't recommend uses the other profiles since they are outdated or can be further optimized.
Backup or Restore
This section allows users to backup and restore the settings in stweaks. It will take approximately 30secs for stweaks to restore user settings. The app will restart and the values should all be restored.
Settings Backup
Press this button to backup your stweaks settings. The settings will be saved in the internal sd card on your phone and will be called default.profile.backup. You can open this file in notepad or wordpad to edit settings externally
Settings Restore
Press this button to restore your stweaks settings. Read the description of the section about how long to wait and app behavior.
Dualboot
This section allow you to reboot your phone in several ways. DorimanX kernel supports dualbooting, and you can boot into 2 different roms during the boot process or via app. In order to boot into 2nd rom, the 2nd rom needs to be installed first. To install second rom, go into recovery and dualboot settings. The buttongs should be straightforward here
Bug-Report
Allows users to report any stweak/kernel specific bugs. Pressing this button will create a log file on your internal sd card which can be used to diagnose any kernel problems.
Partitition Status
Use this button to check your phone's partitions for errors (data, system, cache, efs and preload). This will NOT fix any errors, it will just check. To fix, backup your files with a backup app or making a nandroid backup (backup via recovery), then press the data and cache fix button located in the OTHER tab. USE IT AT YOUR OWN RISK SOME DATA MAY BE LOST DURING THE FIXING PROCESS! If there's any broken apps, reinstall them. If you get bootloop, reinstall rom. If you are stuck on boot, wipe phone than install rom. If it says your partitions are CLEAN, your partitions should have no errors. Usually if your partitions has errors, the stock browser will pop up saying that your partitions need to be fixed.
Kernel-Update
Allows to check of updates. Again this feature doesn't work properly anymore. And so ignore the message saying that there is a newer version of the kernel!
Extras
Gives info about your phone. That's about it!
For now, I will be taking a break. Wait to tomorrow for more info!
The following settings only apply to my personal dorimanx builds
Other
TCP algorithm
Congestion control strategies (or algorithms) are used by TCP, the data transmission protocol used by many Internet applications. The main goal of a TCP algorithm is to avoid sending more data than the network is capable of transmitting, that is, to avoid causing network congestion. Different algorithms respond differently to network loads, but they are all based on the same principle of avoiding network congestion.
This setting allows you to choose what TCP algorithm should be used for internet transmission. Changing this will result in changes to latency and download speeds (differences are marginal or hard to measure).
My Recommendation: Use Westwood or Cubic as they are the most reliable and best for performance.
Troubleshooting
This is the troubleshooting section of the guide. It is important that you read this first before blaming anyone else. Remember that in XDA, we are here to help each other.
Phone doesn't boot?
There may be a few cases where after you flash dorimanX kernel, your phone will fail to boot. This is quite a broad problem which has many aspects that may have caused this to occur. The common mistake is people do not read before they flash. THAT IS FINE, EVERYONE HAS TO START SOMEWHERE. Simply read the post regarding to kernel versions, download the correct version, put it on your phone, then flash the kernel.
If that doesn't work, we can narrow the problem down to the file you've downloaded or the custom recovery. There is chance that the kernel zip you've downloaded is corrupted. If that's the case, download it again. If you have trouble installing a kernel on your phone, flash a kernel .tar file via ODIN. Need a .tar file, have a look at my guide here:
Stweaks doesn't save my settings
Stweaks has safety features that safeguard your phone from any damage, especially from overvolting and overclocking. Because of this, the values will reset to defaults. As frustrating as it is, this is the only way for keeping your phone from its death. There are some cases where Stweaks doesn't even save your settings, this is usually because of the app it misbehaving (aka glitching) or it's because of permission issues. If you face this problem, try reflashing the kernel. Reboot your phone and see if it's working properly. If not, you may have issues with the permissions given to stweaks. Check if you've given root access to stweaks, without root, stweaks is useless.
After installing dorimanX kernel, my battery life has been horrible
If you face battery problems after installing dorimanX kernel, you can revert to a previous backup of your rom and kernel or flash a different kernel. Kernel developers don't intend to make kernels that use a lot of battery life, in fact, it's the opposite. Most issues regarding to battery life is usually caused by the kernel not being able to determine the new setup environment. Give your phone a few charge cycles before you make your judgement! Battery life is usually affected by the combination of both ROM + Kernel, so the combination is very important if you consider battery life!
My phone freezes when screen is off/Freezes when screen switches on
Also known as Sleep Of Death (or SOD), this can occur when a value changed regarding to the CPU or GPU is changed to unstable values. This issue commonly occurs when you undervolt your CPU too low, causing the CPU to be unstable. In a event such as this, force your phone to reboot by removing and re-inserting your phone's battery. After that, Stweaks would have already reset to defaults, removing any further instabilities. If you still consider changing those values, try reduce the amount of the value you are changing.
My phone reports that there is 16 CPU steps. Shouldn't there be less
I won't go too technical in this, but in simple, DorimanX include more than the required CPU frequency steps to allow CPU frequencies to scale efficiently. By samsung default, there is 5 CPU steps. The advantages of having 16 steps is that CPU scaling will be more efficient as the frequencies don't scale up or down too frequently as middle frequencies are used. Also, this allows the user to have more control over the overclocking and voltage capabilities over the CPU. You cannot change the number of steps unless you change the CPU governor to darkness.
Phone is laggy on boot up
Isn't it always the case that your phone is laggy when you first boot up your phone? Your phone needs to load all of the services and startup apps before you can fully use your phone. Give your phone a little patience then enjoy your new experience.
My Setup
Phone: Samsung Galaxy S2 i9100
DorimanX kernel version: 10.44 v008
Max CPU frequency: 1200mhz
Min CPU frequency: 200mhz
Undervolting: -20mV for each step
Awake CPU gov: HYPER
Sleep CPU gov: Ondemand
I/O scheduler: SIO
Credits List
- DorimanX (the master behind DorimanX kernel)
- Cybernetus (for providing the last real DorimanX kernel for i9100 users)
- Computoncio for also providing i9100 users dorimanx builds
- Other XDA members that I haven't listed
Guide updated on the 21/04/15. Please be patient. I have school work to worry about too.
gsstudios said:
Guide updated on the 21/04/15. Please be patient. I have school work to worry about too.
Click to expand...
Click to collapse
Good thread, will be very useful to "new" i9100 survivors who's looking for a way to tame one of best custom kernels around..
Just a suggestion, you might want to add informations about CPU Group limitation/compatibility related to OV/UV, as one setting wont fit all..
And also there is no safe voltage guidelines for each groups yet, just incase you wanna go there
Twiq said:
Good thread, will be very useful to "new" i9100 survivors who's looking for a way to tame one of best custom kernels around..
Just a suggestion, you might want to add informations about CPU Group limitation/compatibility related to OV/UV, as one setting wont fit all..
And also there is no safe voltage guidelines for each groups yet, just incase you wanna go there
Click to expand...
Click to collapse
I'll see what I can do today
Update: Added a few more descriptions. Still busy with school work....
@gsstudios
I recomand u to try to sec cpu thread shold (boost up) higher at 1000 mhz and 1.2 ghz ?
Why ?
I'm using my phone with maximium freq 800 mhz. And it is still smooth and fast. Even in game in which i normally had big heat up and batt drain is smooth. Phone is only laggy when mediascanner is running or app is installing. I'm olso using Live Wall Paper.
And why higher boost up not maximum freq 800 mhz ?
Because if u open app like Asphalt and Real Racing or Facebook [emoji14] phone will go to higher frequences but only when it is important. And imoprtant doesnt mean scrolling through app drawer
Wysłane z Cyano-fonika 11 nightly...
MikiGry said:
@gsstudios
I recomand u to try to sec cpu thread shold (boost up) higher at 1000 mhz and 1.2 ghz ?
Why ?
I'm using my phone with maximium freq 800 mhz. And it is still smooth and fast. Even in game in which i normally had big heat up and batt drain is smooth. Phone is only laggy when mediascanner is running or app is installing. I'm olso using Live Wall Paper.
And why higher boost up not maximum freq 800 mhz ?
Because if u open app like Asphalt and Real Racing or Facebook [emoji14] phone will go to higher frequences but only when it is important. And imoprtant doesnt mean scrolling through app drawer
Wysłane z Cyano-fonika 11 nightly...
Click to expand...
Click to collapse
Nice.
Guide updated today. Finished the basic guide to stweaks. Now will start to work on advanced guide. Please note that I will NOT go through every setting in stweaks, but I'm going to cover the more important ones instead. Advanced guide should be completed by next week.
@gsstudios
I have a little problem.
I have olny toutched setting u told that we can savety touch. And u have a problem. Whan i leave device without touching it , the cpu frequency wont go under 500 mhz. Is that normal ?
Wysłane ze Slim-Saberd-fonika 4.3.1 R powered by DorimanX v008 kernel
MikiGry said:
@gsstudios
I have a little problem.
I have olny toutched setting u told that we can savety touch. And u have a problem. Whan i leave device without touching it , the cpu frequency wont go under 500 mhz. Is that normal ?
Wysłane ze Slim-Saberd-fonika 4.3.1 R powered by DorimanX v008 kernel
Click to expand...
Click to collapse
What setting was this? Was it the up threshold. Try resetting back to default values to fix problem.
@gsstudios
Problem fixed.
Rebooted device and now it goes lower.
Ps. I use really big up threshold. 73 % : )
Wysłane ze Slim-Saberd-fonika 4.3.1 R powered by DorimanX v008 kernel
@gsstudios
Can u post in one od OP post full stock CPU voltages ? I noticed , that STweaks changed my setting a few times (lowerd my CPU freq and staff like that) and now I'm not sure if i have my lower volatages are set or they are resetted to default.
Wysłane ze Slim-Saberd-fonika 4.3.1 R powered by DorimanX v008 kernel
Great job ..will help lots of people...
Troubleshooting guide is up. Enjoy
Thnq

Categories

Resources