yashsingh1/xdaforums huggingface dataset:
[Xiaomi Redmi Note 4 Guides, News, & Discussion] karamancho:
Do I need to redo these changes after each update?

If yes can this be set using a magisk module?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] coolpixs4:
Can I use this tweak on Miui9 Miuipro V8.3.1 (stock kernel) for Note 4X SND 3/32GB ???

I have enabled init.d folder and then put 00userinit.sh to that folder, set permission 0755

after reboot, I can see init_test.log file in root/data/ => it means init.d works

But when I check the command

su
cat /sys/devices/system/cpu/cpufreq/interactive/target_loads

it gives result just

85 1804800: 91

seem the CPU tweak script not work

What do I have to do ?

Thanks

How about this tweaks ? https://xdaforums.com/redmi-note-4/themes/mod-kernel-tweaks-mido-t3987215

with modification

...
if [ "$govvie" == "interactive" ]; then
write /proc/sys/kernel/sched_big_waker_task_load 44
write /proc/sys/kernel/sched_init_task_load 33
write /proc/sys/kernel/sched_small_wakee_task_load 13
write /proc/sys/kernel/sched_spill_load 98
write /proc/sys/kernel/sched_ravg_hist_size 5
write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 95
write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay 10
write /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq 652800
write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 60000
write /sys/devices/system/cpu/cpufreq/interactive/timer_slack 480000
write /sys/devices/system/cpu/cpufreq/interactive/target_loads "80 652800:57 1036800:67 1401600:75 1689600:9 1804800:85 1958400:87"
write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 0
write /sys/devices/system/cpu/cpufreq/interactive/io_is_busy 1
write /sys/devices/system/cpu/cpufreq/interactive/ignore_hispeed_on_notif 0
write /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif 1
write /sys/devices/system/cpu/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpufreq/interactive/screen_off_maxfreq 1036800
write /sys/devices/system/cpu/cpufreq/interactive/fast_ramp_down 0
write /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration 0
...

===========
[Xiaomi Redmi Note 4 Guides, News, & Discussion] :
There should be a folder for profiles in Internal Memory, just add it in and the profile should be inside the app.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
I'm shocked this place isn't closed yet. I'm commandeering this.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Sachin:
That's Noice. ?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
OP I highly suggest you hardcode these values via your kernel tbh. its working good on my device + your kernel

---------- Post added at 11:48 PM ---------- Previous post was at 11:42 PM ----------

is it recommended to just straight up rename/delete the perfd file (system/vendor/bin) instead of going through terminal on every boot? its sooooo tiring
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
I'd rather that nothing gets deleted. We're trying to automate all those tweaks through anykernel since it can't be coded into the kernel. Not much success though, we're still researching into it.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
Aight. So far I'm running these tweaks with perfd disabled by renaming the file. Everything seems to be working fine (phone deep sleeps and everything)

3.50 SOT with 71% remaining. Not bad at all
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adrxano:
Is it not possible you could make your tweaks into a flashable zip and upload em for us to download? I really wanna be getting your kind of SOT. I already have perfd disabled.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
Im using his kernel (faust kernel) and thats it really
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adrxano:
My bad I thought you were using the mediatek redmi note 4 cause I've seen you on the mediatek forums. Do you think these tweaks would work for the mediatek variant
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Watanabe_You:
The tweaks will work but it needs to be modified to your frequency and voltage since they are different sources.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
[MENTION=8355076]FaustTN[/MENTION] - your list says

target_loads: 80 652800:57 1036800:67 1401600:75 1689600:9 [U]1843200[/U]:85 1958400:87

However, the frequency list on my device (/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies) reads

652800 1036800 1401600 1689600 [U]1804800[/U] 1958400 2016000
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
Good catch, thanks. Edit done.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
You're welcome. Is there any reason for leaving out the 2ghz frequency?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
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.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
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

#!/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
###
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Watanabe_You:
Nice.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
Yeah, I'm trying to integrate it into anykernel2 rather than relying on init.d so that these tweaks come packaged with the kernel itself and makes sure they get implemented. Like franco's RN3 kernel.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Indeed, it would be wonderful to have it all built into the kernel. However, the difficulty will arise when someone wishes to change some of your default settings without having to compile and flash a kernel (and you could not possibly have a kernel with default settings that meets everybody's needs). So I think that initd will still be needed to override your default values when someone needs to.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
I wanna try this settings what mentioned on first post.

I have change these numbers, and at every bot set up that in terminal emulator?

I saw that script, but i dont really know how to activate that skript, can you implement your Tweaks into your kernel and the script too? (Faust kernel) So jsut install kernel and there it is, the tweaks and the script too.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
the easiest way to do this is install kernel auditor and go the init.d section and paste the script there

so basically kernel auditor does the init.d method even if you dont't have init.d

---------- Post added at 03:01 AM ---------- Previous post was at 02:58 AM ----------

I am for this.

I think you should be stern with what you think is best and set up a hard default.

Easier for end users as they dont have to do much work and also easier for you because you dont have to debug if users try to deviate from your default values.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Thanks!

Then tomorrow i reinstall my phone, full wipe for all, and then install OctOS, and the Faust kernel, after that i download Kernel Auditor, set the numbers, and any other settings, and then try to find how to insert script in Kernel Adiutor..
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
YEAH scratch that. Kernel Aidiotor init.d eulation doesnt work (on magisk at least anyway rofl)

PLEASE DONT USE MY SCRIPT LMFAO
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
What you have partially copied and pasted does nothing - and it also has errors (no closing brace for function "TweakInteractive", no function called "Main", etc).
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
can you check the edited version now if its correct? (I did copy it from your post lol)
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Your copy isn't exactly the same as his version.

If i activate his script, what he originally wrote in Kernel Audiutor?

I want to work this tweaks, i love hack my phone :D
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
You did not copy the whole script, as someone else has pointed out. Your edited version still doesn't do anything other than to declare some functions, which are not called anywhere. To made it do something, you need at least to add this to the end;

StopServices
TweakInteractive
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Then I should use your original script in Kernel Adiutor, right?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
I know nothing about Kernel Adiutor (I have never installed it, and I prefer to do my own implementations, which I have complete control over). However, my script should work perfectly fine with anything that implements initd functionality.

By the way, for my own initd implementation, see this thread (especialy post #2).
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Szabi01:
Thank you very much, applied in EX Kernel Manager, no errors. So, I need to write that thing into terminal everytime I reboot my phone?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
If you had initd functionality, you only need to copy the script to the /system/etc/init.d/ directory, and set its permssions to 0755. Then it will be automatically executed every time the phone is rebooted.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Szabi01:
Just did it using Ex Kernel Managar, thank you so much!
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Anyone tried to edit the numbers what mentioned in first post?

As Faust said, that isn't yet a fine tune, need to tuning it yet.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] maxxx83:
Can you share your init.d script here for me?I using miui.eu nougat and i have init.d folder in system/etc
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
The script was posted in post #35. However, just having the /system/etc/init.d/ folder is not sufficient for full initd functionality. It is too complicated to explain the ins and outs of this, but you you need something that gives full initd functionality. Perhaps Kernel Adiutor does - and another app was mentioned by some else (Ex Manager, I believe). My own initd mod (which I referred to in an earlier post) also does this (you will need to install it each time you change your ROM).
[Xiaomi Redmi Note 4 Guides, News, & Discussion] maxxx83:
I see that post but when i copy/paste your post it get messy and it's not like in that post.And when i try to create script it give me error can't create.That why i ask already done scrip just to copy it in inid.t forder.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
ok now I see my errors

the version i copied just ommitted the other non-governer tweaking stuff (like selinux)

Once again, can you help check if im doing this correct.

Just trying to help out a brother here without them having have to install init.d
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
I am not sure what you mean by "it gets messy". If it does not display correctly in your text editor, perhaps that is because your text editor does not understand unix text files?

Anyway, the script is attached (change the file extension from ".txt" to ".sh" before copying it).

Note: if you are not rooted, then you cannot copy this to the init.d directory.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Yes, it is correct now.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
IT DOPESNT WORK LOL

you guys will havbe to do it manulalky via kernel audotor or some other kernel manager
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
[MENTION=2078083]asusm930[/MENTION] Again, what you have just posted is incomplete (things missing at the bottom). I really think you need to check these things carefully! Best to put the stuff in a text file, and then attach that to a post (just like I have done above).
[Xiaomi Redmi Note 4 Guides, News, & Discussion] asusm930:
I hope its all good now
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
I dont find init.d directory, where it is?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] maxxx83:
Thanks for sharing bro.Is this script also set selinux to permissive?I have root.So just copy it to system/etc/init.d and set right permissions...is only that?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
/system/etc/init.d/

---------- Post added at 06:10 PM ---------- Previous post was at 06:05 PM ----------

The call to SetPermissive is commented out in the script. If you want it to run, then you need to remove the "#" from before the call, and then save the file, and reboot.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Yeah found already, thanks!

Soon i upload some screenshot if all ok or not.

And how i can check if the tuned numbers are actives or not?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Try running this from a root terminal

cat /sys/devices/system/cpu/cpufreq/interactive/target_loads
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Permission denied.

But in Magisk manager i dont see the terminal emulator like root-user app. Which root terminal do you recommend?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
https://play.google.com/store/apps/details?id=jackpal.androidterm

Open the terminal, run the "su" command, which will give you root access, and then you are free to do whatever from there (including trashing the entire system - so tread carefully).
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Sorry I'm noob in command line.

Can you write me the full command with the su command too? I tried write in it the "su" but mot works. Thansk!
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Run the terminal app, then when the terminal window opens, run each of these commands, and press ENTER after running it. When you run the first command for the first time, SuperSU will prompt you for root access. Grant the root access.

su
cat /sys/devices/system/cpu/cpufreq/interactive/target_loads
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Thanks! I think all ok :)
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Yes, it is ok.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Another reboot, script is working, the numbers all ok :) Thank you! :)

50 min sot on 95% :D Sick.... Okay, true, Sync off and the lowest brightnes and use in wifi, but too very good... And using chrome + messenger, the most power-hungry apps.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] dagasp10:
Why it tells me "changing permissions was not successful", i tried 2 root file manager

EDIT: ok, i gave it the right perm but settings don't load on boot
[Xiaomi Redmi Note 4 Guides, News, & Discussion] ojankun:
Hi, is there any methods to implement these settings besides using KA or EXKM? Like it's permanently edited and starts at boot?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Yes. You can:

(1) install an initd patch and put the settings in an initd script, or

(2) download some techie tools like AndroidMasterChef, extract and edit the ramdisk in the boot image and change the default settings.

---------- Post added at 10:13 PM ---------- Previous post was at 10:08 PM ----------

Here are some settings for improved battery performance during sleep/idle

echo "0" > /dev/cpuset/background/cpus # (default='0-1')
echo "0-1" > /dev/cpuset/system-background/cpus # (default='0-3')
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Hawkeye007:
[MENTION=5850987]DarthJabba9[/MENTION] hey bud, thanks for providing us with your script! I have pasted the script in Init.d folder and I have also copied it to kernel adiutor emulator. Upon booting up the phone it shows applying settings, but when I paste cat /sys/devices/system/cpu/cpufreq/interactive/target_loads in terminal it shows the original values. In fact when I check kernel auditor for governor tunable, the values are unchanged. Can you please tell me what went wrong? Thank you.!
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
Unfortunately, I can't tell you what went wrong. First, I don't know what exactly you pasted, whether it is complete, whether it has the correct line endings, and whether it has the correct permissions. Secondly, I know nothing about Kernel Adiutor. If the script is complete, and has the correct line endings and permissions, it should work. If it doesn't work, then that is up to Kernel Adiutor, which I can't speak for.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Hawkeye007:
I downloaded the file you had attached in your post. The permissions were set to 755, pasted in /system/etc/init.d folder. Also if you don't use kernel adiutor any other software you use?

Using aicp btw, i dont know if it has init.d support.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
I use my own initd implementation.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] razibrizal:
I think just manually copy then paste variable using exkm or ka and set apply on reboot is a good way because less error in my opinion
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
And when KA/EXKM don't do the job?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] razibrizal:
Then why OP suggested using exkm or ka?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Hawkeye007:
The problem is you need to open terminal and type in stop perfd everytime you reboot. Something you will forget for sure when you reboot 10 time a day.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] razibrizal:
I though you can disable perfd using exkm, i saw the option inside cpu setting
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Hawkeye007:
I dont use exkm, trying the script right now. If it doesn't work i'll give exkm a shot. Thanks for telling btw!

---------- Post added at 01:41 PM ---------- Previous post was at 01:37 PM ----------

@DarthJabba9 I flashed your initd implementation and then copied the script to initd... Voila! Works like a charm. Thank you very much.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] DarthJabba9:
You're welcome :good:

---------- Post added at 04:37 PM ---------- Previous post was at 04:35 PM ----------

Perhaps it worked for him.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adekboreanaz:
Does the tweak works with other kernel? Not only yours ?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Watanabe_You:
It works as long as the kernel has Interactive governor and is using it.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adekboreanaz:
I used velvet kernel, and max freq stay at 1689, and when i chamged to max 20x it keeps changing to 1689, anyone know what's i need to change?

Edited, my cpu needs max when it needs to be max freq, thanks to this tweaks
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adekboreanaz:
I use script manager and using the script that gave from previous page, set on boot, and perfd is stop on boot, i didn't choose init.d because on my init.d after dirty flashing weeklies or nightly it's goes disappeared, amd sometimes i forgot to using the tweaks again
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
I have attached a copy of my kernel here, that automates the disabling of perfd among other tweaks. Do note that Interactive governor tweaks must still be done by yourself, I still haven't been able to permanently set those.

If you'd like your kernel dev to implement it as well, please request them to add Spectrum support and use my anykernel2 scripts [anykernel.sh & /ramdisk/init.spectrum.rc] as a template if they'd like.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] ~billie joe~:
im just finished tweaking governor using your tutorial. Im just copying the value given by you. So, if im using your kernel, do i still need to tweaking the governors?
[Xiaomi Redmi Note 4 Guides, News, & Discussion] FaustTN:
Yes, just the governor values.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adekboreanaz:
I used stock MIUI here, that's why i don't use your kernel "yet", thanks for letting me know

I've read your kernel just support 7.1.2, my stock on 7.0
[Xiaomi Redmi Note 4 Guides, News, & Discussion] Watanabe_You:
I think I got an idea. Open the zip file and delete image.gz-dtb and try flashing (backup boot.img first). Since you're deleting the new kernel image the original one will probably remain inside but you still get the tweaks.

Edit: Or if you know how to use AIK (Android Image Kitchen) by osm0sis you'll probably be able to take out the original image to rename and replace inside the kernel zip.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] adekboreanaz:
Thanks, btw i have this tweak since yesterday, i'll try to do what you suggested
[Xiaomi Redmi Note 4 Guides, News, & Discussion] holozis_HUN:
Damn i can't open the velvet kernel post, its say i havent permission (where can i get permission???).... Well... Can you give me an other extrenal link( Github etc) for see the lsit of features in that kernel.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] ming86:
thermal-engine throttle CPU frequency to 1689 MHz when case_therm sensor temperature above 41 'C.
[Xiaomi Redmi Note 4 Guides, News, & Discussion] ipsmith:
Installed it, and it's working better than i expected!!

Thanks for the information