[Tweak] Interactive Governor Tunables for Redmi Note 4 Snapdragon variant

Search This thread

FaustTN

Senior Member
Jun 20, 2017
138
353
Hi guys, I'll make this short and sweet. A few years ago, I stumbled on this little guide for the Interactive governor, which made a lot of changes in CPU scaling and has spread to many devices.


To make a long story short, OEMs usually ramp up your CPU to more than what is needed to ensure smooth performance. This guide, changes that by ramping up your CPU to the minimum amount needed to get the same effect. The result? Lower frequencies used equals more power saved without impacting performance.

It's like a car race. If you take on a tight corner at high speed, you go in fast but you still need to slow down or risk crashing. But if you decelerate to just the right speed, you consume less energy while ensuring not much of your acceleration is sacrificed in the process.


This will be the best time to release this thread because we now have our voltage values from the kernel source, which provides the real change in these tweaks.

Calculations and stuff

We take the voltage values, and see what gives the highest jump when switching frequencies.
Code:
1401 MHz to 1689 MHz = 5v increase
1958 MHz to 2016 MHz = 75v increase

We don't care about the small increase, as they are negligible. The real drains are in the huge jumps in voltage.
So, we have the following frequencies with large differences when they jump:
652 MHz = 75v
1036 MHz = 70v
1843 MHz = 70v
1958 MHz = 75v

Then, we take into account the minimum frequency to ensure smooth tasks:
  • Idle = 652 MHz
  • Scrolling = 1036 MHz (Use Chrome browser to scroll Facebook in desktop mode)
  • Video = 1401 MHz (Play 1080p*60fps videos in Youtube app)
  • App load = 1843 MHz (Use any app really)
  • High load = 2016 MHz (Max out just in case)

I will be skipping explaining all the formulas and maths but you're welcome to check them out in the original thread and refer it to our frequencies + voltage

CPU Load:
652 MHz = 57
1036 MHz = 67
1401 MHz = 75
1689 MHz = 9
1843 MHz = 85
1958 MHz = 87



Soooo what now?
I'll be taking their Hawktail profile, as it seems to work the best. Any newer profile from that thread is built specifically for the Nexus 5x.

You should use a kernel manager app to implement these values, I recommend Kernel Adiutor Mod if you want free, or you can pay for EXKM made by one of the more senior developers in XDA.

Code:
go_hispeed_load: 95
above_hispeed_delay: 0
timer_rate: 60000
hispeed_freq: 652800
timer_slack: 480000
[B]target_loads: [/B] 80 652800:57 1036800:67 1401600:22 1689600:84 1804800:83 1958400:87
min_sample_time: 0
ignore_hispeed_on_notif: 0
boost: 0
boostpulse_duration: 0
align_windows: 1
use_migration_notif: 1
use_sched_load: 0
max_freq_hysteresis: 0

Hopefully it helps you as it seems to help me. Discussion is more than welcome here, as these are just rough calculations that isn't fine tuned yet for our CPU.

Additionally, open a terminal emulator app and type these:
Code:
su
stop perfd

This will prevent the Qualcomm binaries from taking over the CPU scaling and leave it up to the governor instead.
 
Last edited:

dastan4eva

Senior Member
Jul 28, 2014
667
150
Can you make an exkm loadable profile for absolute noobs like me .

Sent from my Redmi Note 4 using Tapatalk
 

antimatter.web

Senior Member
Jan 27, 2014
180
32
Hi, these settings apply to both the little and the big cluster or just one of those?

Sent from my Redmi Note 4 using Tapatalk
 
Last edited:

antimatter.web

Senior Member
Jan 27, 2014
180
32
Going back on topic: These settings seem pretty great! Currently off the charger for 47 hours with +5 hours SOT and 30% left! LOS 14.1 with autumnQueen92 kernel tweaks. All radios active too [emoji106] [emoji15] Screenshot_20170521-134324.png
dadb6b5551f3fc7a1e3a345f31b39425.jpg
c0c2815ee0b3fe70859104ab85e86756.jpg


Sent from my Redmi Note 4 using Tapatalk
 
N

notauseranymore

Guest
Going back on topic: These settings seem pretty great! Currently off the charger for 47 hours with +5 hours SOT and 30% left! LOS 14.1 with autumnQueen92 kernel tweaks. All radios active too [emoji106] [emoji15]
Sent from my Redmi Note 4 using Tapatalk

Sounds good. What was your previous SOT like?
 

antimatter.web

Senior Member
Jan 27, 2014
180
32
Well, before that I had the Helio X20 variant and it would rarely last 24 hours with ~6 hours SOT.
With the Snapdragon variant on miui 8.2.5.0 global I got about 8 hours SOT over 36 hours. I then switched to LOS. 14.1 after a single cycle. This certainly seems to be an improvement in both standby and in-use consumption.

Sent from my Redmi Note 4 using Tapatalk
 

alexeei

Senior Member
Jul 2, 2008
283
215
May be error in this line 80 652800:57 1036800:67 1401600:75 1689600:8 1843200:85 1958400:87, as i think it must be 1689600:80, or i'm wrong?
 
N

notauseranymore

Guest
May be error in this line 80 652800:57 1036800:67 1401600:75 1689600:8 1843200:85 1958400:87, as i think it must be 1689600:80, or i'm wrong?


Nope, it's correct. It'll be more efficient to skip that frequency instead since the voltage jump isn't high.
 

alexeei

Senior Member
Jul 2, 2008
283
215
And one more question, we need apply part "su stop perfd" every time after reboot or it's need once?
 

antarix

Senior Member
May 16, 2012
1,553
513
Surat
go_hispeed_load: 95
above_hispeed_delay: 0
timer_rate: 60000
hispeed_freq: 652800
timer_slack: 480000
target_loads: 80 652800:57 1036800:67 1401600:75 1689600:9 1843200:85 1958400:87
min_sample_time: 0
ignore_hispeed_on_notif: 0
boost: 0
boostpulse_duration: 0
align_windows: 1
use_migration_notif: 1
use_sched_load: 0
max_freq_hysteresis: 0
@AutumQueen92 after applying these values kernel adiutor shows Max CPU frequency 1689Mhz

Sent from my Redmi Note 4 using Tapatalk
 
N

notauseranymore

Guest
go_hispeed_load: 95
above_hispeed_delay: 0
timer_rate: 60000
hispeed_freq: 652800
timer_slack: 480000
target_loads: 80 652800:57 1036800:67 1401600:75 1689600:9 1843200:85 1958400:87
min_sample_time: 0
ignore_hispeed_on_notif: 0
boost: 0
boostpulse_duration: 0
align_windows: 1
use_migration_notif: 1
use_sched_load: 0
max_freq_hysteresis: 0
@AutumQueen92 after applying these values kernel adiutor shows Max CPU frequency 1689Mhz

Sent from my Redmi Note 4 using Tapatalk


Can you set the max to 2016 MHz? I've never heard of this problem before, so I'm not sure why it's behaving this way. Could be a problem with the app itself.
 

alexeei

Senior Member
Jul 2, 2008
283
215
go_hispeed_load: 95
above_hispeed_delay: 0
timer_rate: 60000
hispeed_freq: 652800
timer_slack: 480000
target_loads: 80 652800:57 1036800:67 1401600:75 1689600:9 1843200:85 1958400:87
min_sample_time: 0
ignore_hispeed_on_notif: 0
boost: 0
boostpulse_duration: 0
align_windows: 1
use_migration_notif: 1
use_sched_load: 0
max_freq_hysteresis: 0
@AutumQueen92 after applying these values kernel adiutor shows Max CPU frequency 1689Mhz
May be you make some error, apply in Kernel adiutor also, and max frequency same as it was-2016mhz
 

phyowaidd

Senior Member
May 23, 2017
57
27
Yangon
go_hispeed_load: 95
above_hispeed_delay: 0
timer_rate: 60000
hispeed_freq: 652800
timer_slack: 480000
target_loads: 80 652800:57 1036800:67 1401600:75 1689600:9 1843200:85 1958400:87
min_sample_time: 0
ignore_hispeed_on_notif: 0
boost: 0
boostpulse_duration: 0
align_windows: 1
use_migration_notif: 1
use_sched_load: 0
max_freq_hysteresis: 0
@AutumQueen92 after applying these values kernel adiutor shows Max CPU frequency 1689Mhz

Sent from my Redmi Note 4 using Tapatalk
Open kernal auditor > Thermal > disable VDD restriction .
You r good to go:D
 

Top Liked Posts

  • There are no posts matching your filters.
  • 38
    Performance vs Power Consumption vs Clock Speed

    I ran some test on mido using Trepn Perfiler and GeekBench 3, here is the Performance vs Power Consumption vs Clock Speed result.
    During the test, GPU clock is set to 216 MHz. screen lowest brightness, auto-brightness off. flight mode with WiFi On.

    GeekBench 3 benchmark score vs Clock Speed
    xqfIP0kIgPfBeM5OXbMs5YWUioicre3EFG_GjYpvOUuJEg-w9S-yNx44VGre_qJEsWVRPOvj2MSJeiYYiTjphEg_sJFD2WvUWoh2vI5_c3ut1OZ_msR6PsKISwtX1mdJ_923cQhGuf4=w600-h371-no

    Here, CPU min and max clock speed set to tested frequency, and then run Geekbench 3.
    Relationship for benchmark performance and clock speed is linear.

    Relative Performance to Max Performance (Geekbench)
    tG--JiIuJmd65tOo9Hk2iQmJNjtaCr5QaVY3zm6hkZ8XoEBvwMiX-TeZjQ5XW56r7_37SsKKtXmI3UgapX8tC5nwb_8Gol0HTdZLxmyckwS1VZeOJWHevMpOSo0QmtUpb9NiOPZVmqY=w600-h371-no


    CPU Power consumption (Idle and Full load)
    -GmRVW_dvNTAm5sW56WSBD-aYtJqaZQ-Fe2rnlBU54jJqbKv3LL1JT8YTdVjV2n9a7A5kXCsbVpLhG7OFTujXwopB308Jy_N1cuTwZ91aEwnTAgQ3j359jl9dzhdDKwE4886YpF0vdM=w600-h371-no

    Power consumption is nearly linear before 1689 MHz, power consumption start to increase exponentially after 1689 MHz.

    Performance and Power Consumption relative to 652 MHz
    tafu-J9X5tlYMwHz6oIvpN4obFnaKcPRzhzOknKM4ekqtf6SDo1k-VXIrZhVYzEi9FSE4XBdU5XlqOcNjf5IISqnlzqeKLREEuGZYSy7gQPF755Zv4vkGptkEqmQRGtT0B4TUMiutzI=w600-h371-no

    From this chart, we know that performance/watt for clock speed above 1689 MHz is worse.

    Performance and Power Consumption increase % relative to previous Clock Speed
    GjfY26JzXKXtJggy1igamt3X0dffk56xnJn9JNKBXq1cqFFnvvxLNgPSFduuHhomPUhJXlgzXPf2jR7dRHezf2ZBDL6YkPk3duqbbk4rdpISuhZg015__Zgnb0NFAMHOgaQGxvwvnPs=w600-h371-no

    From this chart, each clock speed ramp up increase about 45% power consumption compare to to previous clock speed, while performance is not increase so much, especially after 1689 MHz.

    Conclusion: If you want best performance/watt, set max CPU frequency to 1689 MHz, we can get 84%/87% of the max performance, with 37.5% less power consumption (calculation assume full load).
    19
    Hi guys, I'll make this short and sweet. A few years ago, I stumbled on this little guide for the Interactive governor, which made a lot of changes in CPU scaling and has spread to many devices.


    To make a long story short, OEMs usually ramp up your CPU to more than what is needed to ensure smooth performance. This guide, changes that by ramping up your CPU to the minimum amount needed to get the same effect. The result? Lower frequencies used equals more power saved without impacting performance.

    It's like a car race. If you take on a tight corner at high speed, you go in fast but you still need to slow down or risk crashing. But if you decelerate to just the right speed, you consume less energy while ensuring not much of your acceleration is sacrificed in the process.


    This will be the best time to release this thread because we now have our voltage values from the kernel source, which provides the real change in these tweaks.

    Calculations and stuff

    We take the voltage values, and see what gives the highest jump when switching frequencies.
    Code:
    1401 MHz to 1689 MHz = 5v increase
    1958 MHz to 2016 MHz = 75v increase

    We don't care about the small increase, as they are negligible. The real drains are in the huge jumps in voltage.
    So, we have the following frequencies with large differences when they jump:
    652 MHz = 75v
    1036 MHz = 70v
    1843 MHz = 70v
    1958 MHz = 75v

    Then, we take into account the minimum frequency to ensure smooth tasks:
    • Idle = 652 MHz
    • Scrolling = 1036 MHz (Use Chrome browser to scroll Facebook in desktop mode)
    • Video = 1401 MHz (Play 1080p*60fps videos in Youtube app)
    • App load = 1843 MHz (Use any app really)
    • High load = 2016 MHz (Max out just in case)

    I will be skipping explaining all the formulas and maths but you're welcome to check them out in the original thread and refer it to our frequencies + voltage

    CPU Load:
    652 MHz = 57
    1036 MHz = 67
    1401 MHz = 75
    1689 MHz = 9
    1843 MHz = 85
    1958 MHz = 87



    Soooo what now?
    I'll be taking their Hawktail profile, as it seems to work the best. Any newer profile from that thread is built specifically for the Nexus 5x.

    You should use a kernel manager app to implement these values, I recommend Kernel Adiutor Mod if you want free, or you can pay for EXKM made by one of the more senior developers in XDA.

    Code:
    go_hispeed_load: 95
    above_hispeed_delay: 0
    timer_rate: 60000
    hispeed_freq: 652800
    timer_slack: 480000
    [B]target_loads: [/B] 80 652800:57 1036800:67 1401600:22 1689600:84 1804800:83 1958400:87
    min_sample_time: 0
    ignore_hispeed_on_notif: 0
    boost: 0
    boostpulse_duration: 0
    align_windows: 1
    use_migration_notif: 1
    use_sched_load: 0
    max_freq_hysteresis: 0

    Hopefully it helps you as it seems to help me. Discussion is more than welcome here, as these are just rough calculations that isn't fine tuned yet for our CPU.

    Additionally, open a terminal emulator app and type these:
    Code:
    su
    stop perfd

    This will prevent the Qualcomm binaries from taking over the CPU scaling and leave it up to the governor instead.
    4
    Hi colleagues!
    Here is my vision of this tweaks and my version of the script according to ming86 Performance vs Power measurements and based on soniCron formulas.
    This script should been installed into /system/etc/init.d/99_cpu_init and implements these tweaks, installs ZRAM SWAP and some other minor parameters. One can change it by editing /system/etc/init.d/99_cpu_init in it's ### Config section
    Only standard init.d implementation and busybox are required.

    TWRP installable
    4
    The Mi A1 has separate kernel sources, so it is different in terms of ROM.
    even MI5 can using governor tweak for OP3

    ---------- Post added at 01:09 PM ---------- Previous post was at 01:03 PM ----------

    but it's the same 625 snapdragon
    im suggesting you using interactive tweak by Velvet, its more battery life. here it is, you can change manually using EXKM or Kernel Adiutor

    /sys/devices/system/cpu/cpufreq/interactive/timer_slack 480000
    /sys/devices/system/cpu/cpufreq/interactive/timer_rate 60000
    /sys/devices/system/cpu/cpufreq/interactive/target_loads 95 652800:57 1036800:67 1401600:75 1689600:80 1804800:85 1958400:87
    /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 0
    /sys/devices/system/cpu/cpufreq/interactive/ignore_hispeed_on_notif 0
    /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq 652800
    /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 95
    /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay 0
    /sys/devices/system/cpu/cpufreq/interactive/align_windows 1
    /sys/devices/system/cpu/cpufreq/interactive/boost 0
    /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration 0
    /sys/devices/system/cpu/cpufreq/interactive/enable_prediction 0
    /sys/devices/system/cpu/cpufreq/interactive/fast_ramp_down 0
    /sys/devices/system/cpu/cpufreq/interactive/max_freq_hysteresis 0
    /sys/devices/system/cpu/cpufreq/interactive/powersave_bias 0
    /sys/devices/system/cpu/cpufreq/interactive/screen_off_maxfreq 1401600
    /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif 1
    /sys/devices/system/cpu/cpufreq/interactive/use_sched_load 0
    3
    Yeah, because 1958400:87 means stay at that frequency until CPU load hits 87%, then jump to 2ghz. There are no more frequencies after 2ghz so just leave it.
    Thanks. By the way, if your ROM has a functioning initd, you can put these things in a script: "/system/etc/00_init" and this will be executed automatically every time the phone starts. This is a copy of my script
    Code:
    #!/system/bin/sh
    
    #
    # Initd script for Snapdragon 625
    #
    
    # Stop running boot-time services
    StopServices(){
      stop perfd
    }
    
    setgov() {
      local DIR=/sys/devices/system/cpu/cpufreq/interactive/
      echo $2 > $DIR/$1
    }
    
    # Tweak Interactive Governor
    TweakInteractive() {
        setgov go_hispeed_load 95
        setgov above_hispeed_delay 0
        setgov timer_rate 60000
        setgov hispeed_freq 652800
        setgov timer_slack 480000
        setgov target_loads "80 652800:57 1036800:67 1401600:75 1689600:9 1804800:85 1958400:87"
        setgov min_sample_time 0
        setgov ignore_hispeed_on_notif 0
        setgov boost 0
        setgov align_windows 1
        setgov use_migration_notif 1
        setgov use_sched_load 0
        setgov max_freq_hysteresis 0    
        setgov boostpulse_duration 0
        setgov enable_prediction 0
        setgov fast_ramp_down 0
    }
    
    #Set selinux to permissive if needed
    SetPermissive() {
      setenforce 0
    }
    
    # Limit CPU max freq
    # Select a valid freq from this list: /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    # Valid list for SD625 = 652800 1036800 1401600 1689600 1804800 1958400 2016000
    LimitCPU() {
    #F=1401600
    #F=1958400
    F=1804800
      echo $F > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    }
    
    #FSTRIM
    FSTRIM() {
      busybox fstrim /data
      busybox fstrim /system
      busybox fstrim /cache
    }
    
    # Misc
    Misc() {
    # set the "Apps and ADB setting" that is "missing" from the Developer options
      setprop persist.sys.root_access 3 
    }
    
    # Main - call all routines (uncomment to activate each line)
    Main() {
    	StopServices
    	TweakInteractive
    	#Misc
    	#SetPermissive
    	#LimitCPU
    	FSTRIM
    }
    
    ###
    Main
    ###