*Disclaimer:
This is my first stab at scripts so please consider this a WIP in alpha stage. I would suggest making a backup before putting it in ../system/etc/init.d
- alpha2 now with working init.d support!
I shall not be held responsible for any damage that may arise from use of this mod, use at your own risk. That said, I've been studying imoseyon's sysctl tweaks and pukachu01's ThunderBolt! and using this as the daily driver on HOV for a good while now, so I hope it would not cause any issues for people.
However, as this mod favors the use of swap, it is expected to wear out the phone's internal NAND faster, and may decrease the life expectancy of your device. But since HOV has gotten so cheap lately combined with the fact it has no user replaceable battery, I'd expect it reach EOL earlier for other reasons than a dead NAND.
*Who is this for?
Myself really, but anyone on maxwen's latest CM10 (2012/12/08) for HOV w/ the latest Hellboy Kernel is welcome to try it. I'll try and keep it updated with the latest CM10 builds if necessary. This mod is currently specific to CM10 (2012/12/08) and I do not intend on maintaining it for other ROMs, but anyone is welcome to port/kang any part of this mod to any ROM or device without telling me about it. I am a big proponent of Creative Commons and really don't care about credits.
*What does it do?
This collection of tweaks attemps to make CM10 more responsive for the average user who mainly uses HOV as a phone. I am focusing on subjective performance in daily use, and this will not turn HOV into a gaming console or some Flying Spaghetti Monster! Coming from AOSP Slim ROMs which defaults at 182 DPI, I find it hard to go back to the stock 240 DPI setting. This makes the small screen feels much larger than it really is. Just increase the font size under CM10 System Settings to compensate for shrunken characters.
Sample Screenshots:
{
"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"
}
I intend on making full use of swap to improve multi-tasking while keeping the launcher and essential phone related things in memory to minimize lags.
The script is designed to keep about 100 MB of memory free so that there should be minimal lag starting apps or playing light games with such overhead.
High Swappiness value usually makes the phone slower, but by locking the launcher in memory and tweaking LMK for high free RAM, the ill effects of swap seem to be mitigated.
But again, no tweak/script is perfect for everyone...
While this works great for me playing games that take about 100MB of memory at max, I've gotten the phone to stutter heavily doing some stress testing, and I have yet to do any longevity tests. If you experience heavy stuttering at some point please try editing vm.swappiness to a lower value like 80.
The script enables KSM, sets BFQ scheduler and ondemand governer with tweaked tunables. You may also choose to use SmartAssV2 which offers better scrolling performance, but I find the tweaked ondemand quite smooth already and offers better battery life. (sets OC to 1497Mhz but favors 806Mhz 2-phase freq at 1100mV for battery)
I've also made 2 smartassV2 presets for those who want more performance to play with.
====
Thanks to Lloir, maxwen, and all the unnamed contributors (to come?) for making One V a great phone!
Without you people we'd still be stuck on HTC Sense!
alpha2, added new flavors of smartassV2
*How to Use?
Download CM10_20121208_build.prop.h and rename to build.prop, replace ../system/build.prop with this file and set permission rw- r-- r--
Download the script version and extract from .7z archive, place in ../system/etc/init.d, then set permission to rwx r-x r-x
You may also try executing the script with a script manager app to try out the effects.
I ran the script through Scripter from ROM Toolbox and got no errors, but please let me know if anything doesn't work.
I "might" try and make flashable zips but I am thinking about holding off until some reports come back.
[Spoiler for next release (WIP)]
My current HWA Blacklist
Code:
adb shell ls -la /data/local/hwui.deny
-rw------- system system 0 2012-12-01 02:13 ccc71.bmw.pro
-rw------- system system 0 2012-12-01 02:45 com.adam.aslfms
-rw------- system system 0 2012-12-01 02:10 com.aes.cron4phonefree
-rw------- system system 0 2012-12-01 02:40 com.android.browser
-rw------- system system 0 2012-12-01 02:53 com.android.calculator2
-rw------- system system 0 2012-12-01 02:16 com.android.calendar
-rw------- system system 0 2012-12-01 02:38 com.android.certinstaller
-rw------- system system 0 2012-12-01 02:41 com.android.defcontainer
-rw------- system system 0 2012-12-01 02:18 com.android.development
-rw------- system system 0 2012-12-01 02:38 com.android.email
-rw------- system system 0 2012-12-01 02:19 com.android.exchange
-rw------- system system 0 2012-12-01 02:13 com.android.inputmethod.latin
-rw------- system system 0 2012-12-01 02:17 com.android.inputmethod.pinyin
-rw------- system system 0 2012-12-01 02:40 com.android.mms
-rw------- system system 0 2012-12-01 02:39 com.android.providers.applications
-rw------- system system 0 2012-12-01 02:16 com.android.providers.calendar
-rw------- system system 0 2012-12-01 02:20 com.android.providers.downloads
-rw------- system system 0 2012-12-01 02:19 com.android.providers.downloads.ui
-rw------- system system 0 2012-12-01 02:42 com.android.providers.drm
-rw------- system system 0 2012-12-01 02:20 com.android.providers.media
-rw------- system system 0 2012-12-01 02:17 com.android.providers.telephony
-rw------- system system 0 2012-12-01 02:43 com.android.providers.userdictionary
-rw------- system system 0 2012-12-01 02:16 com.android.smspush
-rw------- system system 0 2012-12-01 02:15 com.android.spare_parts
-rw------- system system 0 2012-12-01 02:15 com.android.stk
-rw------- system system 0 2012-12-01 02:41 com.android.voicedialer
-rw------- system system 0 2012-12-01 02:14 com.avast.android.antitheft
-rw------- system system 0 2012-12-01 02:14 com.bel.android.dspmanager
-rw------- system system 0 2012-12-01 02:14 com.cyanogenmod.updater
-rw------- system system 0 2012-12-01 02:45 com.droid27.transparentclockweather
-rw------- system system 0 2012-12-01 02:09 com.easyjp.apps.localesetter
-rw------- system system 0 2012-12-01 02:10 com.evernote
-rw------- system system 0 2012-12-01 02:10 com.evernote.widget
-rw------- system system 0 2012-12-01 02:43 com.google.android.apps.genie.geniewidget
-rw------- system system 0 2012-12-01 02:13 com.google.android.apps.translate
-rw------- system system 0 2012-12-01 02:15 com.google.android.apps.uploader
-rw------- system system 0 2012-12-01 02:20 com.google.android.feedback
-rw------- system system 0 2012-12-01 02:14 com.google.android.gm
-rw------- system system 0 2012-12-01 02:51 com.google.android.gsf.login
-rw------- system system 0 2012-12-01 02:13 com.google.android.inputmethod.latin
-rw------- system system 0 2012-12-01 02:17 com.google.android.inputmethod.latin.dictionarypack
-rw------- system system 0 2012-12-01 02:20 com.google.android.location
-rw------- system system 0 2012-12-01 02:19 com.google.android.onetimeinitializer
-rw------- system system 0 2012-12-01 02:19 com.google.android.partnersetup
-rw------- system system 0 2012-12-01 02:14 com.google.android.syncadapters.calendar
-rw------- system system 0 2012-12-01 02:19 com.google.android.tts
-rw------- system system 0 2012-12-01 02:10 com.jrummy.busybox.installer
-rw------- system system 0 2012-12-01 02:12 com.keramidas.TitaniumBackup
-rw------- system system 0 2012-12-01 02:11 com.maxmpz.audioplayer.unlock
-rw------- system system 0 2012-12-01 02:46 com.mikersmicros.fm_unlock
-rw------- system system 0 2012-12-01 02:15 com.noshufou.android.su
-rw------- system system 0 2012-12-01 02:15 com.svox.pico
-rw------- system system 0 2012-12-01 02:13 jp.co.johospace.jorte
-rw------- system system 0 2012-12-01 02:16 net.cactii.flash2
-rw------- system system 0 2012-12-01 02:11 ru.org.amip.MarketAccess
-rw------- system system 0 2012-12-01 02:45 uk.co.nickfines.RealCalc
- Need to slim this down a bit so it can be a basic list for most people
DSPManager EQ Preset tuned for HOV's speaker by a talented musician!
- Louder and more neutral sound!
- Thanks to foolen
windowsmgr.max_events_per_sec=150
- Thanks to 1ceb0x for the suggestion
vm.swappiness = 90
- so far encountered 3 cases of heavy stuttering when switching between games, so might as well bump it down
[122012 alpha2]
build.prop update
- Testing windowsmgr.max_events_per_sec=180, but 150 works well too.
script update
v021 Tweaked Ondemand - fixed typo
v02 Tweaked smartassV2 - Balanced Battery Life
- v021 smartassV2 battery better tweaked smoothness
v02 Tweaked smartassV2 - Balanced Performance
- v021 smartassV2 performance better tweaked smoothness
- script now works from init.d
- swappiness=90, less chance of big stuttering
- added balanced performance & balanced battery life presets for smartassV2 governor
[121612 alpha for CM10 2012/12/08]
- deprecated & replaced by 122012 alpha 2
- swappiness=100
- minfree=1024,1024,20480,20480,20480,25600
----
Build.prop tweaks:
- 160 DPI Phablet Mode (Please goto System Settings -> Accessibility and enable "Large text")
- Enabled HWA Blacklist Support (Does not include app blacklist)
- Lock Holo Launcher HD in memory as Foreground App, no more launcher redraws!
- Keeps Contacts and Launcher in memory, and who still uses MMS?
Code:
sys.keep_apps=com.android.contacts,com.mobint.hololauncher.hd
- If you happen to use MMS, try adding the com.android.mms to the line:
Code:
sys.keep_apps=com.android.mms,com.android.contacts,com.mobint.hololauncher.hd
- Replace "com.mobint.hololauncher.hd" string with "com.cyanogenmod.trebuchet" if you use default CM launcher, or the package name of any other launcher of your choice.
- Possibly increased responsiveness with windowsmgr.max_events_per_sec=300
- Scan for WIFI only once every 10 minutes, saves battery when you forget to turn WIFI off upon leaving a hotspot.
If you'd like to edit your own build.prop below are the proposed changes:
Code:
ro.sf.lcd_density=160
hwui.use.blacklist=true
windowsmgr.max_events_per_sec=180
sys.keep_apps=com.android.contacts,com.mobint.hololauncher.hd,com.cyanogenmod.trebuchet
If you want to try alternative screen density like 182 or 200, please flash the all DPI Modded Play Store first.
Will give it a go when I have time...I'm on PA!
shubhamchamaria said:
Will give it a go when I have time...I'm on PA!
Click to expand...
Click to collapse
Please be aware that this was developed solely based on CM10 + Hellboy, the script part may possibly work without modifications but if you would likely have to cherry pick through the build.prop and use only stuff compatible with PA. (Absolutely no experience with PA)
Well you seem to be a much more experienced developer than I am so I am just throwing out the disclaimer for others.
will try !
will try it on CM9..LOL..it will be changed for CM9.
All these except the task killer changes already exist in latest PA. Please be aware that anyone who flashes this I will no longer support them if they encounter anything by any matter.
And what's the deal posting this in Development thread? You did not discover America and i am pretty sure these scripts/build prop lines are not yours. Reported - move to general thread!
Sent by a PA proud user!
I'm gonna install cm10 later,ill try em when I install ....
no signature....problem ?!?!?!
1ceb0x said:
And what's the deal posting this in Development thread? You did not discover America and i am pretty sure these scripts/build prop lines are not yours. Reported - move to general thread!
Click to expand...
Click to collapse
I actually did some searches before posting and similar posts from other device forums tend to be in development section hence the posting.
I do not claim to have invented anything new nor care about credits. This is no more than how I have been tweaking android towards the behavior I tend to use it.
In fact most tweaks and values can be found from other threads or sites and I find it somewhat senseless to give credits for setting a certain minfree values, I just try and understand how each tweak affect our devices under a certain environment, personally test them and released the collection I settled with here. I don't use benchmark softwares and don't expect quadrant scores to go up, in fact the scores might even go down because of swap, or create heavy stuttering in some games / heavy multi-tab browsing if the said application exceed the "overhead" I tried keeping and swap started causing heavy io activity. (This I try to avoid with the proposed settings) This is a low-end device with limited ram after all, I just try to squeeze out a bit more performance based on how I think most users (and I) might use this phone.
Anyhow, if mods see fit please move thread over to the general section.
Be advised that you set "windowsmgr.max_events_per_sec=300" but instead it should be at 160 max. This should be calculated as: our display refresh rate x 2.
I usually set it to 150 and it works greater than setting to 300 or too low than 100.
1ceb0x said:
I usually set it to 150 and it works greater than setting to 300 or too low than 100.
Click to expand...
Click to collapse
Thanks for the advice.
I am testing 150 now, so far so good.
So HOV is natively 75fps?
A bit of Googling yields this review which shows 59.6 FPS (closest integer 60?) in Neocore, makes me think maybe the setting really should be 120 under the 2x logic, might as well test this too for now.
I may also try editing the setting on my Galaxy S to 112 and see, I believe this device is at 56fps.
--
Might be placebo but I think it does feel different, especially on SGS everything seem to "flow", similar can be said about HOV but not as apparent. Maybe because HOV cm10 has no vsync?
Honestly I can't tell if windowsmgr.max_events_per_sec makes a whole lot of difference, might not pursue this much further.
Examining build.prop tweaks for Android ICS: A comprehensive guide (Part 1)
Code:
// This number equates to the refresh rate * 1.5. The rate should be at least
// equal to the screen refresh rate. We increase the rate by 50% to compensate for
// the discontinuity between the actual rate that events come in at (they do
// not necessarily come in constantly and are not handled synchronously).
// Ideally, we would use Display.getRefreshRate(), but as this does not necessarily
// return a sensible result, we use '60' as our default assumed refresh rate.
result = 90;
This blog post calls the tweak busted anyway... but I guess it doesn't hurt.
nereis said:
Thanks for the advice.
I am testing 150 now, so far so good.
So HOV is natively 75fps?
A bit of Googling yields this review which shows 59.6 FPS (closest integer 60?) in Neocore, makes me think maybe the setting really should be 120 under the 2x logic, might as well test this too for now.
I may also try editing the setting on my Galaxy S to 112 and see, I believe this device is at 56fps.
--
Might be placebo but I think it does feel different, especially on SGS everything seem to "flow", similar can be said about HOV but not as apparent. Maybe because HOV cm10 has no vsync?
Honestly I can't tell if windowsmgr.max_events_per_sec makes a whole lot of difference, might not pursue this much further.
Examining build.prop tweaks for Android ICS: A comprehensive guide (Part 1)
Code:
// This number equates to the refresh rate * 1.5. The rate should be at least
// equal to the screen refresh rate. We increase the rate by 50% to compensate for
// the discontinuity between the actual rate that events come in at (they do
// not necessarily come in constantly and are not handled synchronously).
// Ideally, we would use Display.getRefreshRate(), but as this does not necessarily
// return a sensible result, we use '60' as our default assumed refresh rate.
result = 90;
This blog post calls the tweak busted anyway... but I guess it doesn't hurt.
Click to expand...
Click to collapse
it is not placebo. the difference is there. i felt it numerous times when a crappy rom was laggy. i put this line in build prop and everything seems to fly .
jub...confirming it...works !!! much snappier now with 100+ mb ram always free
wonder there could be any battery saving tweaks ... the battery of cm10 is the only thing that keeps me puzzled :|
have a doubt though
# Set IO Scheduler to BFQ
echo "bfq" > /sys/block/mmcblk0/queue/scheduler
# Set 1497Mhz overclock
echo "245760" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1497600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# Set Governor
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
this is supposed to set scheduler to bfq on boot time ... right?
i cant see that happening at boot ... its been shown as deadline at boot
also
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
if i change the "ondemand" to say "smartassv2" will it be reflected at boot as well?
i am a noob in modding, so any help/suggestion will be much appreciated
also is there any way to include tweaks to improve battery life of cm jb
abhikm001 said:
this is supposed to set scheduler to bfq on boot time ... right?
i cant see that happening at boot ... its been shown as deadline at boot
Click to expand...
Click to collapse
Thanks for the feedback, I'll see what I can do.
I believe the governer / scheduler setting under System Settings -> Performance (or some other app like ROM Toolbox) takes precedence over the script though, so please check to see if you have any of those enabled. You can also just tick smartassv2 in CM Performance settings and set at boot.
abhikm001 said:
also
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
if i change the "ondemand" to say "smartassv2" will it be reflected at boot as well?
Click to expand...
Click to collapse
Yes if you change the string to "smartassV2" it will set the governer to smartassv2, <s>but maxwen's smartassv2 does not support any tunables</s>, so you would lose the battery saving ondemand tweaks. Just make sure you edit with Notepad++ so the script will work afterwards.
nereis said:
Thanks for the feedback, I'll see what I can do.
I believe the governer / scheduler setting under System Settings -> Performance (or some other app like ROM Toolbox) takes precedence over the script though, so please check to see if you have any of those enabled. You can also just tick smartassv2 in CM Performance settings and set at boot.
Yes if you change the line to smartassv2 it will set the governer to smartassv2, but maxwen's smartassv2 does not support any tunables, so you would lose the battery saving ondemand tweaks. Just make sure you edit with Notepad++ so the script will work afterwards.
Click to expand...
Click to collapse
Correction maxwen has a tunable smartassv2. Here are screen shots for my settings with smartassv2. Battery friendly and performance.
Sent from my One V using xda premium
rockstar_26 said:
Correction maxwen has a tunable smartassv2. Here are screen shots for my settings with smartassv2. Battery friendly and performance.
Sent from my One V using xda premium
Click to expand...
Click to collapse
Just looked under /sys/devices/system/cpu/cpufreq/smartass/
I stand corrected!
I'll try and make some presets for SmartAssV2 too.
These somehow don't show up under ROM Toolbox, I think maybe the support was added in the latest Hellboy?
nereis said:
Just looked under /sys/devices/system/cpu/cpufreq/smartass/
I stand corrected!
I'll try and make some presets for SmartAssV2 too.
These somehow don't show up under ROM Toolbox, I think maybe the support was added in the latest Hellboy?
Click to expand...
Click to collapse
If you find any good settings please share
I might fork the scripts by governers, I personally like smartassv2 quite a bit, it is more responsive (lower latency in general) than ondemand, and by tweaking awake_ideal_freq to some sensible frequency like maybe 1200Mhz we might be able to also save some juice.
Try the following maybe...
Code:
# smartassV2 Tweaks (Balanced Performance and Battery Life)
echo "smartassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "1200000" > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq
echo "806400" > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq
echo "393600" > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step
echo "297600" > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step
echo "95" > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load
echo "45" > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load
This way you should running be at 1200Mhz (1200mV) most of the time, if you want to try squeeze some more battery life out of smartassv2 setting awake_ideal_freq to "806400" (1100mV) will likely buy you a bit more time.
The max_cpu_load is set to 95% for 1200Mhz awake_ideal_freq, so that cpu doesn't switch to the higher voltage unless really needed. The min_cpu_load is set at a rather high 45% so it would behave almost like a two-step min-max governer jumping between low power 245Mhz & 1200Mhz, only going to 1497Mhz when high load calls for it.
I think 1200Mhz should still be plenty fast for the more demanding users, but I tend to settle for lower.
--
Currently testing the above values for smartassV2, everything is working as expected and more responsive than ondemand, but I would expect somewhat decreased battery life for daily use.
However I did observe that now during games the CPU frequency centers around 1200Mhz instead of 1497Mhz when using ondemand, might actually turn out to have better battery life if you play more games. If you happen to find 806Mhz fast enough for the kind of games you play, setting awake_ideal_freq to "806400" might be even better.
i edited the script with this
# smartassV2 Tweaks (Balanced Performance and Battery Life)
echo "smartassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "806400" > /sys/devices/system/cpu/cpufreq/smartass/awake_ideal_freq
echo "806400" > /sys/devices/system/cpu/cpufreq/smartass/sleep_wakeup_freq
echo "393600" > /sys/devices/system/cpu/cpufreq/smartass/ramp_down_step
echo "297600" > /sys/devices/system/cpu/cpufreq/smartass/ramp_up_step
echo "95" > /sys/devices/system/cpu/cpufreq/smartass/max_cpu_load
echo "45" > /sys/devices/system/cpu/cpufreq/smartass/min_cpu_load
and pasted it to init.d inside system/etc
but i doubt whether this has any effect coz performance section inside settings shows still on demand 245-1024 ghz and i/o scheduler is still dead line according to it (yes, i havent set the apply on boot option, so this is the present stats on boot)
also as i told im not good at scripts, can u gimme a rough idea about applying scripts with script manager.
got some idea, install busy box n all...but dunno how to actually install/apply the scripts and check whether it worked
Related
Hi guys,
UPDATE: Over time, I've modified some of these values in my SpeedMod kernel. The values here may not be the best ones.
NOTE: These tweaks are now included in kernels based on sztupy's Universal Lagfix, for example:
http://forum.xda-developers.com/showthread.php?t=822756
But they must be manually activated from the recovery menu.
I've been using Linux kernel tweaks in a startup script to make the phone smoother.
With these tweaks, the phone is quite smooth and fast even without using the filesystem lagfixes.
These settings are only useful for you if you know how to create and modify a startup script. I use the old playlogos hack myself, but I'm sure there are many new ways to do it now.
Code:
# Tweak cfq io scheduler
for i in $(ls -1 /sys/block/stl*) $(ls -1 /sys/block/mmc*) $(ls -1 /sys/block/bml*) $(ls -1 /sys/block/tfsr*)
do echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/low_latency
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1000000000" > $i/queue/iosched/back_seek_max
echo "3" > $i/queue/iosched/slice_idle
done
# Remount all partitions with noatime
for k in $(busybox mount | grep relatime | cut -d " " -f3)
do
sync
busybox mount -o remount,noatime $k
done
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
#echo "10" > /proc/sys/vm/dirty_ratio
#echo "4096" > /proc/sys/vm/min_free_kbytes
# Tweak kernel scheduler, less aggressive settings
echo "18000000" > /proc/sys/kernel/sched_latency_ns
echo "3000000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "1500000" > /proc/sys/kernel/sched_min_granularity_ns
# Misc tweaks for battery life
echo "2000" > /proc/sys/vm/dirty_writeback_centisecs
echo "1000" > /proc/sys/vm/dirty_expire_centisecs
EDIT: Explanations:
# Remount all partitions with noatime
atime is a setting where the filesystem updates the access time of a file. This creates a write-after-every-read which slows things down. By default all partitions are mounted with relatime, which is an optimized version of atime. noatime is the fastest, and afaik we don't need atime.
# Tweak cfq io scheduler
Tweaked settings of the disk io scheduler more for flash memory. Defaults are optimized for spinning harddisks. Lowered the idle wait, re-enable the low latency mode of cfq, removed the penalty for back-seeks and explicitly tell the kernel the storage is not a spinning disk.
# Tweak kernel VM management
Set tendency of kernel to swap to minimum, since we don't use swap anyway.
Lower the amount of unwritten write cache to reduce lags when a huge write is required.
Increase tendency of kernel to keep block-cache to help with slower RFS filesystem.
Increase minimum free memory, in theory this should make the kernel less likely to suddenly run out of memory.
# Tweak kernel scheduler
Make the task scheduler more 'fair' when multiple tasks are running. This has a huge effect on UI and App responsiveness. These values (less aggressive settings) are 20% of the Linux defaults, and about half of the Android defaults.
# Miscellaneous tweaks
Increase the write flush timeouts to save some battery life.
___________________________________
EDIT: How to create/use a startup script:
You need root and busybox for this.
This procedure is adapted from the old OCLF which used this method to create a startup script in /system/userinit.sh
Check if the file /system/userinit.sh exists. If it does, u should just edit that file as the startup script and DO NOT do the procedure below.
Here's how to do it manually. Do this only if some other lagfix/patch has not already done the playlogos hack, otherwise u might overwrite the other script!
Create the startup script on your PC. Use adb to push it to /sdcard/userinit.sh
adb push userinit.sh /sdcard/userinit.sh
On your PC, create a file called playlogos1 with this content:
#!/system/bin/sh
sh /data/userinit.sh
playlogosnow
Use adb to push the playlogos1 file to /sdcard/playlogos1
adb push playlogos1 /sdcard/playlogos1
Now use adb shell, su and do this:
busybox mount -o remount,rw /system;
busybox cp /sdcard/userinit.sh /data/userinit.sh;
busybox mv /system/bin/playlogos1 /system/bin/playlogosnow;
busybox cp /sdcard/playlogos1 /system/bin/playlogos1;
chmod 755 /system/bin/playlogos1;
chmod 755 /data/userinit.sh;
The startup script will be /data/userinit.sh
The reason I put the startup script in /data is so that if you mess up the startup script and get stuck during boot, you can do a "clear data" from recovery, and the startup script will be erased.
Could you explain what this actually does for the non linux savvy, also maybe you could make a script/app for this so everyone else can try it ?
hardcore said:
Hi guys,
I've been using Linux kernel tweaks in a startup script to make the phone smoother.
With these tweaks, the phone is quite smooth and fast even without using the filesystem lagfixes.
These settings are only useful for you if you know how to create and modify a startup script. I use the old playlogos hack myself, but I'm sure there are many new ways to do it now.
Code:
# Remount all partitions with noatime
for k in $(mount | cut -d " " -f3)
do
sync
mount -o remount,noatime $k
done
# Tweak cfq io scheduler
for i in $(ls -1 /sys/block/stl*) $(ls -1 /sys/block/mmc*) $(ls -1 /sys/block/bml*) $(ls -1 /sys/block/tfsr*)
do echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/low_latency
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1000000000" > $i/queue/iosched/back_seek_max
echo "3" > $i/queue/iosched/slice_idle
done
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
echo "10" > /proc/sys/vm/dirty_ratio
echo "1000" > /proc/sys/vm/vfs_cache_pressure
echo "4096" > /proc/sys/vm/min_free_kbytes
# Tweak kernel scheduler
echo "2000000" > /proc/sys/kernel/sched_latency_ns
echo "500000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "400000" > /proc/sys/kernel/sched_min_granularity_ns
# Miscellaneous tweaks
setprop dalvik.vm.startheapsize 8m
setprop wifi.supplicant_scan_interval 90
setprop windowsmgr.max_events_per_sec 68
Click to expand...
Click to collapse
VERY interesting
EarlZ said:
you could make a script/app for this so everyone else can try it ?
Click to expand...
Click to collapse
+1, pretty plz, also, is this compatible with voodoo?
INeedYourHelp said:
+1, pretty plz, also, is this compatible with voodoo?
Click to expand...
Click to collapse
Should be compatible, although u need to know how to add it into voodoo's startup script.
Hello
Values description for each one and why is welcome
supercurio said:
Hello
Values description for each one and why is welcome
Click to expand...
Click to collapse
Hey supercurio! Great job on Voodoo, I am particularly keen on the Sharpness, Video and future Sound fixes. I think its very cool that you found out how to modify the sharpness (S-AMOLED's PenTile matrix software algorithms?).
Edited the starting post with explanations. Most of them should be documented somewhere in the Linux sources / documents.
I've been using them for a while, tweaking values here n there. I think I've finally reached a stage where I'm confident enough to recommend them to others to try. There could be more optimum values with further testing, but these work well for me with Froyo.
hardcore said:
Hey supercurio! Great job on Voodoo, I am particularly keen on the Sharpness, Video and future Sound fixes. I think its very cool that you found out how to modify the sharpness (S-AMOLED's PenTile matrix software algorithms?).
Edited the starting post with explanations. Most of them should be documented somewhere in the Linux sources / documents.
I've been using them for a while, tweaking values here n there. I think I've finally reached a stage where I'm confident enough to recommend them to others to try. There could be more optimum values with further testing, but these work good for me so far with Froyo.
Click to expand...
Click to collapse
Yeah thank you so much for taking the time and sharing, i'll integrate them after a bit of testing
About the sharpness filter yes this is the main difference between S-AMOLED and AMOLED panel wise.
It's a hardware sharpness filter which is here to fight the fuzziness introduced by the pentile pattern but.. they overdid it a bit.
The "perfect" values are of course closer than the one with the same radius that the one of the blur introduced itself with the pixel pattern.
I feel it can maybe be improved a hair
I'll soon publish a version that allow write to the mDNIe register so you'll be able to play *live* with it too
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
xan said:
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
Click to expand...
Click to collapse
hey xan, you made me remember to add run-parts support.
i'll do that and you'll be able to set it without special hack very soon with voodoo
xan said:
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
Click to expand...
Click to collapse
I don't think the setprop values can be modified post-startup. You can check if the value was modified by doing a getprop. (The default value for that prop is 55.)
The rest of them can be modified post-startup though.
Excuse my noobiness on Android, I would like an explanation on this command:
hardcore said:
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
Click to expand...
Click to collapse
On my GNU/Linux system I've set vm.swappiness to 10, because I've got plenty MiB of RAM and I don't want my system to swap a lot. Is this swappiness the same as Linux? Because that would mean having the system to use more RAM, and since we don't have much of that available by default, I'm just surprised you didn't set a higher value. (I'm not saying you don't know what you're doing, I just want to learn how it works!)
By the way, this script is going to be a must-have, I think you've put an excellent effort on i9000 Android development! Thanks for sharing!
xan said:
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
Click to expand...
Click to collapse
The aosp windowmanager (android framework) ignores values <35. (Samsung could have changed something here, but that is very unlikely).
That value does not affect the framerate, but how many touch events are reported to the apps; this saves some cpu if the user keeps touching the screen.
Fr4gg0r said:
The aosp windowmanager (android framework) ignores values <35. (Samsung could have changed something here, but that is very unlikely).
That value does not effect the framerate, but how many touch events are reported to the apps; this saves some cpu if the user keeps touching the screen.
Click to expand...
Click to collapse
Yes, i tried on Eclair to set it to 56fps (real fps is 55.5555555555555) but touch scrolling were not smoother.
I hope it can be improved in some way!
Fr4gg0r said:
The aosp windowmanager (android framework) ignores values <35. (Samsung could have changed something here, but that is very unlikely).
That value does not affect the framerate, but how many touch events are reported to the apps; this saves some cpu if the user keeps touching the screen.
Click to expand...
Click to collapse
Thanks for the info. Looks like default settings are best unless we can actually change the refresh rate.
supercurio said:
Yeah thank you so much for taking the time and sharing, i'll integrate them after a bit of testing
Click to expand...
Click to collapse
We are eagerly waiting for it =) I don't know when you manage to sleep since you have so many things to do in voodoo =)
hardcore said:
Hi guys,
I've been using Linux kernel tweaks in a startup script to make the phone smoother.
With these tweaks, the phone is quite smooth and fast even without using the filesystem lagfixes.
These settings are only useful for you if you know how to create and modify a startup script. I use the old playlogos hack myself, but I'm sure there are many new ways to do it now.
Code:
# Remount all partitions with noatime
for k in $(mount | cut -d " " -f3)
do
sync
mount -o remount,noatime $k
done
# Tweak cfq io scheduler
for i in $(ls -1 /sys/block/stl*) $(ls -1 /sys/block/mmc*) $(ls -1 /sys/block/bml*) $(ls -1 /sys/block/tfsr*)
do echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/low_latency
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1000000000" > $i/queue/iosched/back_seek_max
echo "3" > $i/queue/iosched/slice_idle
done
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
echo "10" > /proc/sys/vm/dirty_ratio
echo "1000" > /proc/sys/vm/vfs_cache_pressure
echo "4096" > /proc/sys/vm/min_free_kbytes
# Tweak kernel scheduler
echo "2000000" > /proc/sys/kernel/sched_latency_ns
echo "500000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "400000" > /proc/sys/kernel/sched_min_granularity_ns
# Miscellaneous tweaks
setprop dalvik.vm.startheapsize 8m
setprop wifi.supplicant_scan_interval 90
EDIT: Explanations:
# Remount all partitions with noatime
atime is a setting where the filesystem updates the access time of a file. This creates a write-after-every-read which slows things down. By default all partitions are mounted with relatime, which is an optimized version of atime. noatime is the fastest, and afaik we don't need atime.
# Tweak cfq io scheduler
Tweaked settings of the disk io scheduler more for flash memory. Defaults are optimized for spinning harddisks. Lowered the idle wait, re-enable the low latency mode of cfq, removed the penalty for back-seeks and explicitly tell the kernel the storage is not a spinning disk.
# Tweak kernel VM management
Set tendency of kernel to swap to minimum, since we don't use swap anyway.
Lower the amount of unwritten write cache to reduce lags when a huge write is required.
Increase tendency of kernel to keep block-cache to help with slower RFS filesystem.
Increase minimum free memory, in theory this should make the kernel less likely to suddenly run out of memory.
# Tweak kernel scheduler
Make the task scheduler more 'fair' when multiple tasks are running. This has a huge effect on UI and App responsiveness. These values are 10% of the Linux defaults, and about half of the Android defaults.
# Miscellaneous tweaks
Manually set the starting dalvik heap size.
Increase wifi scanning gap to reduce battery usage.
Click to expand...
Click to collapse
I'm interested in doing this but I'm not sure where should I put the file. I checked playlogos1 from /system/bin but it's a binary file.. Tried to find playlogos hack on the forum but can't really find anything...
i have a jpm with voodoo, and i have copy this code into /voodoo/scripts/init.sh
just simplely add to the end of it, of course, before the last line.
the system reboot is ok, but i havent see the effects yet.
btw, "ls -1 /sys/block/mmc*" in adb give us:
Code:
ls -1 /sys/block/mmc*
-1: No such file or directory
/sys/block/mmcblk0
/sys/block/mmcblk1
so, "-1" key is useless
[kab] said:
btw, "ls -1 /sys/block/mmc*" in adb give us:
Code:
ls -1 /sys/block/mmc*
-1: No such file or directory
/sys/block/mmcblk0
/sys/block/mmcblk1
so, "-1" key is useless
Click to expand...
Click to collapse
it should be -l, not one
I want to tweak these settings for ondemand(found in sys/devices/system/cpu/cpufreq)
up_threshold
sampling_down_factor
sampling_rate
powersave_bias
To these values:
85
2
50000
1
The defaults
90
4
10000
0
Problem is I don't know what the init.d script is missing for it to work, as it shows errors in script manager. Here's what I have so far:
#!/system/bin/sh
echo 85 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/powersave_bias
My question is how do I get the script to work so that on every boot the defaults for ondemand change to those?
What do I have add to the script?
I'm using voltage control btw.
This is for my personal use and experimenting purposes.
Just in case you say "search" I did and when I was doing this, here's the guide I followed:
http://forum.xda-developers.com/showthread.php?t=1369817
Hello.
Where is stored the raw file for the User Dictionary of HTC Sense Input keyboard ? It's obviously not the classic /data/data/com.android.providers.userdictionary/databases/user_dict.db ... because I wiped the file, rebooted, and HTC SI still kept memories of some words. After using backup restaure tools like UDM, HTCSI also can't see new words.
Thanks.
State of art:
For every one: the classic user dictionary is in /data/data/com.android.providers.userdictionary/databases/user_dict.db as SQLite3 . It's very easy to extract:
echo "SELECT word FROM words;" | sqlite3 /data/local/tmp/user_dict.db | sort | uniq | sed ':a;N;$!ba;s/\n/\|/g' > /data/local/tmp/PersonalDictionary.htcudb
providing you have SQLite3 somewhere in your PATH.
The base HTC IME dictionary is here: /data/data/com.htc.sense.ime/app_db/dlm_export
The SD backup is not on emulated (I have asked for emulated SD from internal memory), but on real physical external SD:
/storage/ext_sd/.data/HTC_IME/PersonalDictionary
The method to find the two last files were:
- touch /data/local/tmp/plop
- make a change in the dic, or a backup
- find /storage/ext_sd/ -newer /data/local/tmp/plop
or
- find /data/data -newer /data/local/tmp/plop
You have to re-touch the plop each time.
Once /data/data/com.android.providers.userdictionary/databases/user_dict.db is exported into /data/local/tmp/PersonalDictionary.htcudb, two things are possible:
- copy the file into /storage/ext_sd/.data/HTC_IME/PersonalDictionary, and make a manual import from HTC Sense Input dictionary manager
- attach the file to an email, and open the attachement from HTC-Mail, what will restaure the attached backup.
I have found the following command to ask for restauring the backup:
Code:
am start -a android.intent.action.VIEW -d "content:" -t "application/ime-config" -n com.htc.sense.ime/.ui.RestoreUDB -f "0x00080001"
But I do not get the confirmation toast. Because I don't find where the cache file is stored by HTC-Mail, for IME. Since I run stuff from scripts, that command does not work as is; in my case, I have to run it in this context:
Code:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect 127.0.0.1
adb shell id
adb shell su -c id
adb shell su -c am start [...]
otherwise I get a nasty error about permission issues:
Starting: Intent { act=android.intent.action.VIEW dat=content: typ=application/ime-config flg=0x80001 cmp=com.htc.sense.ime/.ui.RestoreUDB }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.VIEW dat=content: typ=application/ime-config flg=0x10080001 cmp=com.htc.sense.ime/.ui.RestoreUDB } from null (pid=29007, uid=2000) requires com.htc.permission.APP_DEFAULT
Click to expand...
Click to collapse
Work for an other day:
- try to construct the am start call for backup restauration from SD (previous line was for email attachement) => give up
- find how to export and rebuild (via script) /data/data/com.htc.sense.ime/app_db/dlm_export
- find if this dictionary is gaining, or loosing any word => stats now on way: cron is recording daily the size of files
- remove dups from /data/data/com.android.providers.userdictionary/databases/user_dict.db (clean PROVIDER file)
- during export, I want to inject Contact details (first name, name, town name)
*** *** ***
The base problem I have is that HTC Sens keyboard is very good, for daily use, but randomly looses settings, and parts of the dics (some times words added the last days; some times 98% of it, only keeping 10 or 15 words).
I want to monitor the IME dic, and produce a system alert when this dic is found to have lost words, and after user confirmation, restaure the IME dic (with an older version of the file, or by rebuilding it).
Some other files may be interesting, in the same folder: mdb_contact_name seem to be a raw text version of com.android.providers.userdictionary/databases/user_dict.db . stm_dump is also very large. IME dictionary has a concept of alias (and auto-replace); but I don't know where this is stored. I also wonder where the word usage statistics are stored (for suggestions).
The big minus I found in this keyboard is that suggestions are always limited to 3 words on the first line (the one always available) (in portrait); Gingerbread and Hackers offer up to 12 words: as much as they can print on screen. Also, suggestions only include literal words: words with letters only; it never suggests words with numbers (unless I already typed one in currect word) or punctuation (statistics show that some words are very often followed by question mark, comma, or full stop).
Now that I am used to the height of HTC Sens keyboard, I make many typos with smaller boards; but smaller boards leave much more screen space for chat. Sens is very good for writing emails; but instant messaging like Skype and Yahoo use too much screen space, and smaller kbd would leave more chat history visible. But Sens has a better word prediction for intuitive chat ...
***
Recoding daily stats of files:
Code:
find /data/data/com.htc.sense.ime/app_db/dlm_export.history -mtime 0 | grep "e" || {
for i in dlm_export mdb_contact_name stm_dump
do
{ echo -n "$(date +%Y-%m-%d_%H-%M-%S) : " ; ls -l /data/data/com.htc.sense.ime/app_db/$i | awk '{print $4}' ; } >> /data/data/com.htc.sense.ime/app_db/${i}.history
done
This code will work even with non existing history. Then wait history is 1D old .... I have found that one history per file is easier to re-read than one for all. Injecting date this way date +%Y-%m-%d_%H-%M-%S ; echo -n " : " used to introduce an undesired NL..
Proof that stupid dictionary bugs:
Code:
-rw------- 1 root root 0 2016-01-24 23:40 dlm_export
-rw------- 1 root root 1274 2015-09-02 10:15 kdb_0c09.cfg
-rw------- 1 root root 1274 2016-01-24 02:29 kdb_0c0c.cfg
-rw------- 1 root root 1281 2014-10-08 14:56 kdb_0d03.cfg
-rw------- 1 root root 1250 2015-12-20 18:18 kdb_0d09.cfg
-rw------- 1 root root 1250 2016-01-24 23:48 kdb_0d0c.cfg
-rw------- 1 root root 28902 2016-01-25 17:01 mdb_contact_name
-rw------- 1 root root 20 2016-01-25 17:01 sc_mdb_contact_name
-rw------- 1 root root 0 2016-01-24 23:40 stm_dump
-rw------- 1 root root 0 2016-01-25 17:01 tc_mdb_contact_name
-rw------- 1 root root 83251 2016-01-29 20:01 dlm_export
-rw------- 1 root root 1274 2015-09-02 10:15 kdb_0c09.cfg
-rw------- 1 root root 1274 2016-01-29 07:30 kdb_0c0c.cfg
-rw------- 1 root root 1281 2014-10-08 14:56 kdb_0d03.cfg
-rw------- 1 root root 1250 2015-12-20 18:18 kdb_0d09.cfg
-rw------- 1 root root 1250 2016-01-29 19:48 kdb_0d0c.cfg
-rw------- 1 root root 28954 2016-01-29 20:57 mdb_contact_name
-rw------- 1 root root 20 2016-01-29 20:57 sc_mdb_contact_name
-rw------- 1 root root 225751 2016-01-29 09:57 stm_dump
-rw------- 1 root root 0 2016-01-29 20:57 tc_mdb_contact_name
-rw------- u0_a39 u0_a39 145060 2016-02-04 23:44 dlm_export
-rw------- root root 29 2016-02-05 01:01 dlm_export.history
-rw------- u0_a39 u0_a39 1274 2015-09-02 10:15 kdb_0c09.cfg
-rw------- u0_a39 u0_a39 1274 2016-02-04 21:20 kdb_0c0c.cfg
-rw------- u0_a39 u0_a39 1281 2014-10-08 14:56 kdb_0d03.cfg
-rw------- u0_a39 u0_a39 1250 2015-12-20 18:18 kdb_0d09.cfg
-rw------- u0_a39 u0_a39 1250 2016-02-05 00:32 kdb_0d0c.cfg
-rw------- u0_a39 u0_a39 29036 2016-02-05 00:32 mdb_contact_name
-rw------- root root 57 2016-02-05 01:01 mdb_contact_name.history
-rw------- u0_a39 u0_a39 20 2016-02-05 00:32 sc_mdb_contact_name
-rw------- u0_a39 u0_a39 225751 2016-02-04 16:07 stm_dump
-rw------- root root 59 2016-02-05 01:01 stm_dump.history
-rw------- u0_a39 u0_a39 0 2016-02-05 00:32 tc_mdb_contact_name
Clearly: dlm_export and stm_dump were empty 2 weeks ago. Due to the nature of cheap backup, I was wondering if by huge hasard, those files were empty due to rsync glitches (if wifi is lost during file transfert, and glitch occurs while working on THIS file ... one chance in a trillion): such a glitch may produce an empty file; one, and ONE ONLY. Not two: rsync can't have corrupted dlm_export AND stm_dump at the same time. Thus, they are both empty due to a HTC Sens bug. The one that often makes the IME forget about second lang, and no vibrator.
Nobody knows if the loss of content of dlm_export could be related to HTC Sense keyboard issues ?
What is Skinny Pro?
This is not for NOOBS - it breaks functionality in Xiaomi apps that try to communicate back to head office. This is an intentional feature and is for people who are not interested in being part of the Xiaomi ecosphere. LEAVE NOW if you have, or intend to log on to Xiaomi and use their services!!!!
Skinny does not magically fix poor choice of ROMs, Apps or lack of knowledge.
It is not a custom Kernel - it is a custom boot.img containing modified initialization scripts for the stock kernel.
There are 2 distinct versions:
Based on 7.1.4.0 - Use for 7.1.xx to 7.3.20 (MIUI7) Support discontinued since V7 (O.P no longer applies to this version)
Based on MIUI8 - use for MIUI7.5.x and MIUI8
Design Brief:
No Placebos
To overcome the limitations of Stock MIUI being:
Poor battery life
Poor performance
Chronic invasion of privacy
Boot.img mods:
Disable starting of non-present devices and services
Disable stock recovery overwriting TWRP
Disable OTA services (no use on a modified ROM)
Disable starting of invasive (spying) services
Disable fingerprint sensor infrastructure (not for our device)
Disable find device infrastructure
Disable second space infrastructure
Build in init.d support
Enable zram swap creation (disable conflicting "mcd" service infrastructure)
Mass Storage Device mode added for external SDCard
Improved TCP Buffer values
Reconfigured internal SDCard suppport to remove uneccessary symlinks
Reduce cpu scheduler, foreground and background tasks deadtime (throttling)
Add some Android 6.0 TCP tweaks
Expose LMK and HPS settings for user configuration
What you will see:
Faster boot
Less background activity at idle
Less RAM usage
Less spying/reporting activity
Better battery life
Better Performance
More reliable and faster data speeds
Install your chosen ROM and get it past the first setup screens before flashing a Skinny Boot image.
If you really must install Xposed, install this after the Skinny boot image.
Do not install "kernel" tweaking apps - they will conflict with the inherent settings in Skinny!
No wipes are necessary after installing the boot.img
What else do I need to do?
First, an explanation as to why we need to set everything the way it is:
The cpu is controlled by 4 separate mechanisms:
1. Thermal throttling - will limit frequencies and shut down cores to stay within safe operating temperatures - will override all other mechanisms. Settings available: High Performance (less strict) or Balanced (default)
2. Performance Server - will temporarily boost freqs and cores depending on detected conditions such as screen touch, screen update or rotate, app open. Limited settings available via /etc/perfservscntbl.txt
3. Hotplugging Service - will add or remove cpu cores as load requires. Some settings are accessible through /proc/hps/
4. Interactive Governor - will throttle freqs up and down based on load and add or remove cores also. Some settings are accessible through /sys/devices/system/cpu/cpufreq/interactive/
You will notice there are competing and often contradicting mechanisms. The factory defaults essentially disable the Interactive governor as being the primary source of initial boosting cpu freqs. The "boost" setting normally found in the governor is non-functional - instead, the Perf Server will boost to 2 cores @ 1183MHz when a potential demand for processing power is detected apart from a simple screen touch. The interactive governor will take over scaling the freq and number of cores after the perf server boost period expires or load demands more cpu power than the boost caters for.
Since the Performance Server tends to over-react, setting 2 cores @ 1183MHz for the smallest of events, we disable it completely by manually editing the existing line in /system/build.prop from:
ro.mtk_perfservice_support=1 to ro.mtk_perfservice_support=0
You must do this yourself - this is vital since all further Governor and Hotplug settings rely upon it being disabled.
Editing /etc/perfservscntbl.txt is not required since this file will no longer be processed.
The settings for the Interactive Governor and Hotplug are modified from factory default to correct a couple of serious problems:
1. The cpu will not reliably throttle back to idle at 403MHz. This has a huge impact on battery.
This is caused by the timer_rate setting being too short allowing transient background activities to trigger scaling the freq up. Increasing the time effectively averages out the transient load spikes so the cpu will not break idle unnecessarily.
2. The cpu does not respond to increasing or decreasing load fast enough creating micro-lags and consuming battery. Reducing the min_sample_time will shorten the time taken for the cpu to lower in freq when load drops off. Reducing the above_hispeed_delay will reduce the response time to increase the cpu freq in response to a load. Both of these settings also compensate for the longer than standard timer_rate that introduces some sluggishness by necessity.
All other values are set to encourage the frequency and number of cores to rapidly and reliably return to idle to save battery while still providing sufficient responsiveness to sudden load demands.
Create an init.d script exactly as follows: (premade file 01_init also available to download)
Code:
#!/system/bin/sh
### CPU freqs standard RN2: 403000, 806000, 1183000, 1326000, 1469000, 1625000, 1781000, 1950000
### CPU freqs PRIME RN2: 403000, 806000, 1183000, 1326000, 1482000, 1664000, 1885000, 2158000
### GPU freqs standard RN2: 253500, 299000, 390000, 442000, 546000
### GPU freqs PRIME RN2: 253500, 338000, 390000, 546000, 676000
# Stop running boot-time services (enable the lines for services you want to stop)
#stop sn # USB serial number allocation
#stop wifi2agps # WiFi assisted GPS (for fine location)
#stop agpsd # Mobile Network assisted GPS (for fine locastion)
#stop emsvr_user # Engineering Mode server
#stop PPLAgent # Privacy Protection Lock
#stop mtkbt # MTK Bluetooth
#stop batterywarning # Battery warning service
#stop debuggerd64 # debug logging
#stop debuggerd # debug logging
#stop logd # logging
#stop autokd # autotune for WiFi
#Set to permissive (enable this line if SE permissive mode is required)
# setenforce 0
# Tweak Interactive Governor (now set in boot.img - enable here to override values)
#echo 403000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq # factory default 1183000
#echo 99 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load # factory default 99
#echo 99 > /sys/devices/system/cpu/cpufreq/interactive/target_loads # factory default 90
#echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate # factory default 20000
#echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time # factory default 20000
#echo 5000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay # factory default 20000
#echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack # factory default 80000
# Limit CPU max freqs (To limit the maximum cpu freq, enable both of these lines. Select a valid freq for your device from table at start)
#echo 1781000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#echo 1781000 > /proc/cpufreq/cpufreq_limited_max_freq_by_user
# Limit foreground CPU cores (set in boot.img - enable here to override values) 0-1 min, 0-7 max Example shows 5 cores (also needs to be set in Hotplug)
#echo 0-4 > /dev/cpuset/foreground/cpus
# Hotplug settings (set in boot.img - enable here to override values) Note: num_limit values are 1-8
#echo 5 > /proc/hps/num_limit_low_battery # factory default 8
#echo 5 > /proc/hps/num_limit_power_serv # factory default 8
#echo 5 > /proc/hps/num_limit_thermal # factory default 8
#echo 5 > /proc/hps/num_limit_ultra_power_saving # factory default 8
#echo 99 > /proc/hps/up_threshold # factory default 95
#echo 87 > /proc/hps/down_threshold # factory default 85
#echo 0 > /proc/hps/rush_boost_enabled # factory default 1
#echo 0 > /proc/hps/input_boost_enabled # factory default 1
# Tweak GPU Settings (Look in /proc/gpufreq/gpufreq_power_dump for power usage at different freqs)
# To disable GPU touch boost:
#echo 0 > /proc/gpufreq/gpufreq_input_boost # factory default 1 (enabled)
# To limit max GPU freq: (Select a valid freq for your device from table at start)
#echo 442000 > /proc/gpufreq/gpufreq_opp_max_freq # factory default 0 (disabled)
# Tweak VM (set in boot.img - enable here to override values)
#echo 300 > /proc/sys/vm/dirty_expire_centisecs # factory default 200
#echo 500 > /proc/sys/vm/dirty_writeback_centisecs # factory default 300
# Tweak LMK (set in boot.img - enable here to override values) 18 37 56 75 93 112MB # factory default 72 90 108 126 219 317MB (MB x 256 = value)
#echo 4608,9472,14336,19200,23808,28672 > /sys/module/lowmemorykiller/parameters/minfree
#Enable zram (no zram set by default, enable first 4 lines if 1 zram required, all 7 lines if 2 zram required)
#echo 40 > /proc/sys/vm/swappiness
#echo 268435456 > /sys/block/zram0/disksize # for single zram: 536870912 = 512MB (for non-prime version) 1073741824=1GB (for prime version)
#/system/xbin/busybox mkswap /dev/block/zram0
#/system/xbin/busybox swapon /dev/block/zram0
#echo 268435456 > /sys/block/zram1/disksize # for 2 zrams: 268435456 = 256MB (for non-prime version) 536870912 = 512MB (for prime version)
#/system/xbin/busybox mkswap /dev/block/zram1
#/system/xbin/busybox swapon /dev/block/zram1
# Tweak IO Scheduler (set in boot.img - enable here to override values)
#echo deadline > /sys/block/mmcblk0/queue/scheduler # factory default cfq (choice: noop deadline cfq)
#echo 128 > /sys/block/mmcblk0/queue/read_ahead_kb # factory default 128 Choose between 128, 256, 512, 1024, 2048
#echo 0 > /sys/block/mmcblk0/queue/add_random # factory default 1
#echo 0 > /sys/block/mmcblk0/queue/iostats # factory default 1
#echo deadline > /sys/block/mmcblk1/queue/scheduler # for ext sdcard (sdcard1)
#echo 2048 > /sys/block/mmcblk1/queue/read_ahead_kb # for ext sdcard (sdcard1)
#echo 0 > /sys/block/mmcblk1/queue/add_random # for ext sdcard (sdcard1)
#echo 0 > /sys/block/mmcblk1/queue/iostats # for ext sdcard (sdcard1)
#Tweak Entropy (set in boot.img - enable here to override values)
#echo 384 > /proc/sys/kernel/random/read_wakeup_threshold # factory default 64
#echo 448 > /proc/sys/kernel/random/write_wakeup_threshold # factory default 128
#Tweak for wifi router connection issues
#echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
# Disable debugging on some modules (set in boot.img - enable here to override values)
#echo 0 > /sys/module/alarm_dev/parameters/debug_mask;
#echo 0 > /sys/module/alarmtimer/parameters/debug_mask;
#echo 0 > /sys/module/binder/parameters/debug_mask;
#echo 0 > /sys/module/earlysuspend/parameters/debug_mask;
#echo 0 > /sys/module/sbsuspend/parameters/sbsuspend_debug_mask;
#echo 0 > /sys/module/snd/parameters/debug;
#echo 0 > /sys/module/pvrsrvkm/parameters/gPVRDebugLevel;
#echo 0 > /sys/module/musb_hdrc/parameters/debug_level;
#echo 0 > /sys/module/lowmemorykiller/parameters/debug_level;
#FSTRIM
busybox fstrim /data
busybox fstrim /system
busybox fstrim /cache
Update BusyBox to version 1.25.1-1 (available to download)
Reduce the number of apps and services needlessly starting automatically at boot. Uninstall or freeze bloat apps. Replace "noisy" apps with better written ones.
Use BetterBatteryStats, WakelockDetector Root or similar to understand what invisible activities are consuming battery.
Use SDMaid, DisableServices, MyAndroidTools or similar to disable autostarts (receivers)and app related services. Use with caution.
To see what boot services are running, type getprop in Terminal. You will see a bunch of entries like [init.svc.66xx_launcher]: [running]
These service must remain running do not stop!:
Code:
[init.svc.66xx_launcher]: [running]
[init.svc.MtkCodecService]: [running]
[init.svc.NvRAMAgent]: [running]
[init.svc.aal]: [running]
[init.svc.ccci_fsd]: [running]
[init.svc.ccci_mdinit]: [running]
[init.svc.drm]: [running]
[init.svc.fuelgauged]: [running]
[init.svc.gsm0710muxd]: [running]
[init.svc.guiext-server]: [running]
[init.svc.healthd]: [running]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.lmkd]: [running]
[init.svc.media]: [running]
[init.svc.mnld]: [running]
[init.svc.netd]: [running]
[init.svc.ril-daemon-mtk]: [running]
[init.svc.sdcard]: [running]
[init.svc.servicemanager]: [running]
[init.svc.shelld]: [running]
[init.svc.surfaceflinger]: [running]
[init.svc.thermal]: [running]
[init.svc.thermald]: [running]
[init.svc.ueventd]: [running]
[init.svc.vold]: [running]
[init.svc.zygote]: [running]
[init.svc.zygote_secondary]: [running]
[init.svc.bmi160d]: [running]
If you only have 1 SIM, it is highly recommended to go into single SIM mode to turn off the second modem service. Edit build.prop existing line from:
persist.radio.multisim.config=dsds to persist.radio.multisim.config=ss
Turn off Developer Options/Memory Optimization and MIUI Optimization. This is a legacy of the mcd service zram configuration that is disabled.
Removal of Apps that are created by symlinks: (Updated information for any ROM version can be found in ROM \META-INF\com\google\android\updater-script)
Uninstall the app where possible and then delete the leftover libs if they exist.
Code:
[B]MAB[/B]
/system/lib/libDToken.so
/system/lib/libNative.so
/system/lib/libShopSigned.so
/system/lib/libentryexpro.so
/system/lib/libsecuritysdk-3.1.27.so
[B]Jeejen[/B]
/system/lib/libJeejenAisound.so
/system/lib/libbspatch.so
/system/lib/libfamily_jni.so
/system/lib/libgetuiext.so
/system/lib/libjeejenmsc.so
[B]MIUI Video[/B]
/system/lib/libDecRes_sdk.so
/system/lib/libminivenus.so
/system/lib/libmresearch.so
/system/lib/libsecurities_sdk.so
[B]Cleanmaster[/B]
/system/lib/libTmsdk-2.0.9-mfr.so
/system/lib64/libTmsdk-2.0.9-mfr.so
/system/lib/libdce-1.1.14-mfr.so
/system/lib64/libdce-1.1.14-mfr.so
/system/lib/libkcmutil.so
/system/lib/libkcmutilex.so
/system/lib/libsic_helper.so
[B]SecondSpace[/B]
/system/lib/libspaces_jni.so
[B]Sogou Input[/B]
/system/lib/libwebp.so
/system/lib/libweibosdkcore_sogou.so
[B]AMAP Network Location[/B]
/system/lib64/libapssdk.so
[B]YellowPage[/B]
/system/lib64/libdidi_secure.so
[B]XMPass[/B]
/system/lib64/libxmpass_sdk_patcher.so
/system/lib64/xmpass_libweibosdkcore.so
[B]PicoTTS[/B]
/system/lib64/libttscompat.so
/system/lib64/libttspico.so
[B]Miui Gallery[/B]
/system/lib64/libwrapnexpcmcalbody.so
/system/lib64/libnexralbody_audio.so
/system/lib64/libnexcralbody_mc_jb.so
/system/lib64/libnexeditorsdk.so
/system/lib64/libPinguoImageSDK.so
/system/lib64/libMiuiGalleryNSGIF.so
/system/lib/libMiuiGalleryNSGIF.so
/system/lib64/libDexHelper.so
[B]MIUI Scanner[/B]
/system/lib64/libQuadrangleRecognizer.so
/system/lib64/libhw_instanttrans.so
/system/lib64/libhwocr_cntools_shared.so
/system/lib64/libsgmain.so
/system/lib64/libsgmainso-5.1.2011.so
/system/lib64/libtbdecode.so
Remove inbuilt virus scanner(s)
Remove GuardProvider.apk and SecurityAdd.apk plus:
Code:
/system/lib64/libams-1.1.7-m-mfr.so
/system/lib64/libams-1.1.7-mfr.so
/system/lib64/libavast-utils.so
/system/lib64/libavast-vps-interface.so
/system/lib64/libavlasys.so
/system/lib64/libavlm.so
/system/lib64/libavlurl.so
Extra libs that can be removed: (if associated apps are removed)
Code:
[B]Lib:[/B]
libfdpp.so Find Device
libfdpp_jni.so Find Device
libffmpeg-miplayer.so Music / MIUIVideo
libhotknot.so
libhotknot_vendor.so
libnfc_ndef.so
libpatcher_game_jni.so
libpatcher_jni.so
libvoicerecognition.so Voice Extensions
libvoicerecognition_jni.so Voice Extensions
libwhetstone_jni.so
libwhetstone_sdk.so
libxiaomimediaplayer.so Music / MIUIVideo
libxiaomiplayerwrapper.so Music / MIUIVideo
[B]Lib64:[/B]
libBaiduMapSDK_base_v4_0_0.so
libBaiduMapSDK_search_v4_0_0.so
libBaiduMapSDK_util_v4_0_0.so
libBankCardRecognizer.so
libduokantext.so
libfdpp.so Find Device
libfdpp_jni.so Find Device
libhotknot.so
libhotknot_vendor.so
libidcardquality_v1.0.3.so
libjni_latinimegoogle.so Google Keyboard
libjni_pacprocessor.so
libjni_unbundled_latinimegoogle.so Stock Keyboard
libnfc_ndef.so
libpatcher_game_jni.so
libpatcher_jni.so
libprintspooler_jni.so Print Spooler
libtbtv3312.so
libTrafficRadar.so
libttscompat.so Pico TTS
libttspico.so Pico TTS
libunipaychsec.so
libweibosdkcore.so
libwhetstone_jni.so
libwhetstone_sdk.so
[B]/vendor/lib64:[/B]
libcom_fingerprints_productiontestmanager.so
libcom_fingerprints_sensor.so
Skinny Pro All versions:
https://drive.google.com/folderview?id=0BwdRTuyj12_yRk9Kcm1pZkxuZzg&usp=sharing
Enjoy
@jajk Awesome work! Do you intend to work on the aosp boot.img much or are you more invested in the miui one (or is it mostly the same project with not many differences between the two types)?
@Sleepy_Augie There is little difference between the 2 flavors so it is easy to keep them in sync
All,
I cannot possibly know what customization other devs are adding to their boot.imgs and whether or not that will make their ROMs incompatible with my boot.imgs. I will try to keep the AOSP version up with current developments while still keeping it "Generic".
Could you include Selinux: Permissive? Zram is better than swap built-in miui ?
@efr07 The beauty of not embedding tweaks - you can choose to be permissive or enforcing in your init.d script rather than me dictating it to all.
setenforce=0 or 1
and to answer the second part....
MIUI uses what could be called a "dynamic swap" system utilizing 4 zram swaps of variable size. The system prioritizes what gets access to that extra memory and what doesn't. No surprises - Xiaomi apps get priority over your own apps. The complexity of this system is so great, it would negate any performance advantage completely but it does make the Xiaomi apps more tenacious than other apps.
@jajk
First things first thank you so much for the effort you have done improving Redmi Note 2,
But I have some question if you please,
I have Miui 7.2.2.0 Lite on my Redmi Note 2 Prime (2.2 ghz) (Rom Link http://en.miui.com/thread-244684-1-1.html)
I have flashed the file as img to boot, and I have done as you said until the int.d thing, I went to #/system/bin/ and I found sh file and opened it in text editor, deleted everything in it and paste what you mentioned, till now we are ok with the device.
I did not find the files that you said I should delete from /vendor/lib, so I went to /vendor/lib64 and deleted the first file, After I deleted it suddenly Root Explorer shut off and whenever I open it again I cant find anything, just blank screen with its symbol and name above and nothing else. Tried to delete Root Explorer and install again and nothing new. Please help, Have I done everything okay? and what should I do to fix this thing and continue deleting the remaining files?
Thank you.
@jajk delete folder /system/etc/radv <- do you mean radvd?
@aghr11 I think that you did not understand the method to create the init.d script and modified an important file instead. You will have to replace that script file you blanked with the original or restore from a good backup and try again. The list of files for deletion is only if they exist in the location as described. If you have enabled any fingerprint settings for some obscure reason, you will probably get locked out of your phone.
Now to creating the script.
Using a text editor, create a file named 01tweaks in /system/etc/init.d folder.
Paste the text (including the first line #!/system/bin/sh) into this file. Leave a blank line at the bottom of the file and make sure your editor is set to Unix end-of-line characters (not Windows)
Save the file and give it 0755 permissions (rwxr-xr-x)
@tonydeli7 Yes, typo I will fix..... done It is a folder to receive advertising pushed to your phone courtesy of Xiaomi!!!!
jajk said:
@tonydeli7 Yes, typo I will fix..... done It is a folder to receive advertising pushed to your phone courtesy of Xiaomi!!!!
Click to expand...
Click to collapse
Yeap, just saw the conf file... WTF are they doing?!
By the way, thanks a lot for this kernel! Nice work!:good::good:
UPDATE:
I edited the latest Multirom Stable (7.2.1.0) and added your kernel&tweaks,deleted the files and everything works great!
I only changed the touchboost value to 806000
jajk, many thanks for this brilliant work!
IIRC, your personal preference for a base ROM with the best behavior and performance with these tweaks was v7.1.4.0 (or was it 7.1.3.0). Is this so or has anything changed? My RN2p is long overdue for an update, still on dev 5.10.29!
If a have a weekly miui based on Miui V 7.3 beta, will it work?
@tonydeli7 Did you give it some time on touchboost 403? I find it does not contribute to lags perceptibly.
@algida79 The most bug free ROM I have come across is MR7.2.30 ID (ported from reno3). I think I had a link to that in the Skinny thread.
Don't load the preloader, uboot or logo from this ROM - edit the updater-script to remove flashing of these. You will need to do an intermediate flash of 7.1.3 or 7.1.4 using SP Flash tool to get all the partitions the way they need to be if coming from an ancient ROM.
@Dnxss Yes it will still work.
@jajk Half an hour I think. I had no lag,just my preference
The phone usage is mostly surfing,facebook,twitter,music playback etc etc with no gaming.
GPS SYNC 3G all on..
Installed app count is around 120..
Includes six reboots while testing ZRAM(disabled it), and if it's good to deactivate Whetstone app.
I also used the app Autostarts to disable useless receivers for many apps like FB etc,and disabled Mail,Voice Unlock,PicoTTS.
I am satisfied..[emoji14]
Sent from my Redmi Note 2 using Tapatalk
@tonydeli7 Whetstone app is a source of a lot of spyware but is not a straight forward removal but you will find that out...
can then also delete:
/etc/WhetstonePermission folder
/system/lib
libwhetstone_jni.so
libwhetstone_sdk.so
/system/lib64
libwhetstone_jni.so
libwhetstone_sdk.so
Yeap, I searched a bit. I am using the Multirom Stable and after flashing the kernel,Whetstone crashes sometimes.
Didn't notice anything weird after freezing it..
This rom doesn't have the line
persist.sys.whetstone.level=2
in the build.prop for some reason.
Sent from my Redmi Note 2 using Tapatalk
@tonydeli7 Whetstone is linked to the mcd service to make things harder to unravel as in all Xiaomi apps. The boot.img disables mcd which is why you will see Whetsone having a fit sometimes. Completely removing Whetstone is a very good thing to do - it may give you an FC on Battery app, delete that too - it chews battery and does not affect normal operation!!!
Anyone wanting to increase their privacy, rename /system/xbin/tunman to tunmanbak. This is the Xunlei data saver/spyware tunneling manager. It is disabled from starting in the boot.img but will still run if called upon like all of the disabled services - they still exist, but not started by default. Make sure it is disabled in the Download Manager Settings
There is another service /sbin/mdbd that appears to be a method of tunneling over usb connections to gain access to a network and on to P.R.C. It is disabled in the boot.img already but I will rename this one in a next revision to be doubly sure it will not start.
Discovered an issue of some apps not recognizing internal sdcard so new versions posted to fix this plus rename /sbin/mdbd to mdbdbak to prevent it from being started after boot. See previous post for the reason.
Back up your internal sdcard contents if you flashed the original images - you will loose everything on sdcard0.
No action needs to be taken if this is a first-time flash.
@jajk How come this version doesn't just dump sd to folder 0? What was merged between miui and pro boot images?
@Sleepy_Augie It is a very complex issue how Android provides a virtual filesystem for SDCards. I thought I could implement it in a simpler fashion as per Android 5.1 which worked well except apps like the stock Contacts are stuck in the dark ages and are hard-coded to still look for the emulated/0 folder for the internal sdcard - not storage/sdcard0.
So going from stock to my original mod leaves an orphaned folder which becomes named 0 because it belonged to user 0. Going back the other way the folder representing access to sdcard0 simply disappears.
The real location of files that appear on the internal emulated sdcard is always /data/media. All other folders that appear to be the same thing are only symlinks to this. Make sense:silly:
Hey @jajk ,
Thanks for the reply, but I have done exactly everything you said and followed all of your steps, but after one day using it, I do not notice any change on battery life, it is still so bad, I have tried everyrom (and every way that was suggested from other users on XDA and MIUI forums including every battery calibration thing) I came across since I bought my RN2p and the maximum battery life I got is nearly 4:30 hours on screen!! After I flashed the boot.img I noticed a slightly more speed booting up the device, the performance is the same (which is good because am all satisfied about the performance except for the battery life).
I have flashed smiui today and it's slightly better consuming energy than the previous ones...
Maybe I have done something wrong doing the 01tweaks thing, if you can upload me yours so I can try paste it in /system/etc/int.d folder, if that will work, then I will be so thankful to you. And if you have any suggestions that I could do to improve and enhance the crazy energy draining then I will be more thankful.
Dear owners,
After buying the J510FN I was frustrated with the way Samsung setup the CPU control for this phone. All 4 cores were on and the minimal freq was 800 Mhz.
This meant worse battery life than possible.
I dig into the kernel to look what was possible. The post boot script /etc/init.qcom.post_boot.sh revealed it all. Our msm8914 soc (Snapdragon 410) could do much better.
I changed the init.qcom.post_boot.sh script to maximize battery life and still get the full performance the Snapdragon 410 offers.
Content of cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies:
Code:
200000 400000 533333 800000 998400 1094400 1190400
Our soc id is 206. In the script I changed these lines to let the cpu use all frequencies and let it switch off CPU cores with Qualcomm core_ctl (like hotplug).
For enable lower cpu freq:
Code:
echo 0 > /sys/module/msm_thermal/core_control/enabled
echo 200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1 > /sys/module/msm_thermal/core_control/enabled
echo "1 200000:25 400000:50 800000:85 998400:90 1094400:95 1190400:98" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
List of /sys/devices/system/cpu/cpufreq/interactive/:
Code:
above_hispeed_delay:25000 1094400:50000
align_windows:0
boost:0
grep: boostpulse: Permission denied
boostpulse_duration:80000
go_hispeed_load:90
hispeed_freq:998400
io_is_busy:1
max_freq_hysteresis:0
min_sample_time:50000
target_loads:1 200000:25 400000:50 800000:85 998400:90 1094400:95 1190400:98
timer_rate:50000
timer_slack:80000
use_migration_notif:0
use_sched_load:0
List of /sys/devices/system/cpu/cpu0/cpufreq/:
Code:
affected_cpus:0
cpuinfo_cur_freq:998400
cpuinfo_max_freq:1190400
cpuinfo_min_freq:200000
cpuinfo_transition_latency:0
related_cpus:0 1 2 3
scaling_available_frequencies:200000 400000 533333 800000 998400 1094400 1190400
scaling_available_governors:interactive userspace powersave performance
scaling_cur_freq:998400
scaling_driver:msm
scaling_governor:interactive
scaling_max_freq:1190400
scaling_min_freq:200000
scaling_setspeed:<unsupported>
Content of /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state:
Code:
200000 749380
400000 98359
533333 15319
800000 303392
998400 140371
1094400 29387
1190400 207512
For enabling cpu core switching on/off:
Code:
insmod /system/lib/modules/core_ctl.ko
echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
echo 80 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
Listing of /sys/devices/system/cpu/cpu0/core_ctl:
Code:
additional_cpus:1
busy_down_thres:60 60 60 60
busy_up_thres:80 80 80 80
cpus:CPU0 (Online)
cpus:CPU3 (Offline)
cpus:CPU1 (Offline)
cpus:CPU2 (Offline)
global_state:CPU0
global_state: CPU: 0
global_state: Online: 1
global_state: Rejected: 0
global_state: First CPU: 0
global_state: Busy%: 16
global_state: Is busy: 0
global_state: Avail CPUs: 4
global_state: Need CPUs: 1
global_state:CPU1
global_state: CPU: 1
global_state: Online: 0
global_state: Rejected: 0
global_state: First CPU: 0
global_state: Busy%: 0
global_state: Is busy: 0
global_state:CPU2
global_state: CPU: 2
global_state: Online: 0
global_state: Rejected: 0
global_state: First CPU: 0
global_state: Busy%: 0
global_state: Is busy: 0
global_state:CPU3
global_state: CPU: 3
global_state: Online: 0
global_state: Rejected: 0
global_state: First CPU: 0
global_state: Busy%: 0
global_state: Is busy: 0
max_cpus:4
min_cpus:1
need_cpus:1
offline_delay_ms:100
online_cpus:1
For this to work you need to change these lines in /system/build.prop too:
Code:
#min/max cpu in core control
#ro.core_ctl_min_cpu=2
ro.core_ctl_min_cpu=1
ro.core_ctl_max_cpu=4
#HR add lower freq (else 800000)
#ro.min_freq_4=200000
ro.min_freq_0=200000
ro.qualcomm.perf.cores_online=1
I am running this two weeks now without any problem. I wonder why Samsung didn't do this out of the box.
Enjoy your very good battery life now. (2 hour/day usage it lasts 5-7 days!!!!)
Cheers
EDIT: I added the modified init.qcom.post_boot.sh attachement. To install use these commands on rooted phone:
Code:
adb push init.qcom.post_boot.sh /sdcard
adb shell
su
mount -o remount,rw /system
cd /etc
cp -p init.qcom.post_boot.sh init.qcom.post_boot.sh.ORG
cp /sdcard/init.qcom.post_boot.sh .
chmod 644 init.qcom.post_boot.sh
exit
exit
adb reboot
EDIT2: I forgot the 533330 freq. Right target_loads should be:
Code:
"1 200000:40 400000:50 533333:70 800000:82 998400:90 1094400:95 1190400:99"
This is not a big deal. You will have to change it in the init script yourself if you want it.
Other little changes to script:
Code:
echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
echo "80 85 90 95" > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
echo 500 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms #100
echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run #3
echo 30 > /proc/sys/kernel/sched_mostly_idle_load # 20
echo 5 > /proc/sys/kernel/sched_spill_nr_run #3/10
echo 0 > /proc/sys/kernel/sched_prefer_idle #0
echo 20 > /proc/sys/kernel/sched_small_task #10
echo 60 > /proc/sys/kernel/sched_heavy_task #0
echo 20 > /proc/sys/kernel/sched_init_task_load #15
echo 5 > /proc/sys/kernel/sched_ravg_hist_size #5 nr sample
echo 500 > /proc/sys/kernel/sched_time_avg_ms #1000
echo 2 > /proc/sys/kernel/sched_window_stats_policy #3
echo 1 > /proc/sys/kernel/sched_tunable_scaling #0 1=log 2=lin
echo 80 > /proc/sys/kernel/sched_upmigrate #80
echo 70 > /proc/sys/kernel/sched_downmigrate #70
echo 500000 > /proc/sys/kernel/sched_freq_inc_notify #10485760 (10Ghz) 500 Mhz
echo 500000 > /proc/sys/kernel/sched_freq_dec_notify #10485760
echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif #0
echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_sched_load #0
echo 95 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load #90
#echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/max_freq_hysteresis #0
optional:
echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo 53059 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
#GPU settings, default pwr level 2 ( max 0 1 2 min)
echo 2 > /sys/class/kgsl/kgsl-3d0/default_pwrlevel #1
Check you CPU with floating Perf monitor from Chainfire
EDIT 25-feb-2017: Added final /etc/init.qcom.post_boot.sh which runs smooth on stock 6.0.1 ROM
Is this better than CM13's kernel?
Can't we optain the same things running CM and Kernel Auditor? If so, can we configure KA to the same paramiters as your kernel?
Have not tried CM or any other kernel. This is stock Samsung kernel with some script tweaks to optimize multi core cpu usage.
Hello
how to get this mod
thank you
I will add my /etc/init.qcom.post_boot.sh script to the OP.
Just copy your init.qcom.post_boot.sh to init.qcom.post_boot.sh.ORG and use my one.
Don't forget to set 644 permissions to it!
Cheers
tweakradje said:
I will add my /etc/init.qcom.post_boot.sh script to the OP.
Just copy your init.qcom.post_boot.sh to init.qcom.post_boot.sh.ORG and use my one.
Don't forget to set 644 permissions to it!
Cheers
Click to expand...
Click to collapse
Thanks!
some time ago i suposed about this file are bloking the cpu to use the lower freq.
but i eliminate it not edit it.
i will test the file and i will post the feedback
thanks again!
CM12.1 doesn't seem to have core_ctl.ko module included, but the frequency scaling should work.
#Down: It won't work. Kernel modules are built with specific kernel version & config in mind and they ain't gonna work between kernels.
Maybe you can try using Samsungs core_ctl.ko?
@tweakradje
Nice. By the way, I see in your screenshot that you've turned off 3 cores. Wouldn't that lead to higher battery drain when there is a high CPU load? Also there might be some lag. The CPU will be stressed more when has only 1 core enabled instead 4 and there is higher load.
I wonder if we can turn on/off cores based on CPU usage. E.g.: if CPU usage is over 50%, then enable 1 core more, just an example.
By the way, I think this should be under apps/mods section.
Cores are hot plugged using core_ctl.ko module.
If mods want to move, be my guest. No problem. I remember next time.
So!
i'm on j500F with custom rom(miui v8 5.1.1) and custom kernel
and i get this with your init.qcom.post_boot.sh:
se the first 6 screenshots
-only 2 core are active
-cant read cpu stats
-cpu performance are on half of it's power
without any init.qcom.post_boot.sh:
see the last 6 screenshots
Ps. the result are not very obiective becouse your init.qcom.post_boot.sh is for j510FN with stok rom and stok kernel
cant say nothing about battery draining, just it was the same on testing
Thanks!
Thank for the feedback. Looks ok. If you look at my sh file you can easily see what parameters I changed. Use that in your own script to check results. Use your phone for a day and check battery usage.
Cheers
Any results?
I am curious if there are users have tried this solution and what the results are. Please let me know.
tweakradje said:
what the results are.
Click to expand...
Click to collapse
what the results are I'll tell you tomorrow.today i say :good:
I make your init.qcom.post_boot.sh J510FN_CPU_control .zip for installation through TWRP
Min_800back.zip-Back stock init.qcom.post_boot.sh
Maybe someone will be needed
To install this, what do I need to do? Just flash in TWRP?
If you have stock Samsung J510 rom you can flash it from post above.
Else follow adb instructions from OP. Make a copy of your original sh file first.
I have the note 7 hybrid rom, will it work??
Think so. Check /etc/init.qcom.post_boot.sh with "adb shell cat /etc/init.qcom.post_boot.sh" from your PC.
Code:
adb push init.qcom.post_boot.sh /sdcard
adb shell
su
mount -o remount,rw /system
cd /etc
cp -p init.qcom.post_boot.sh init.qcom.post_boot.sh.ORG
cp /sdcard/init.qcom.post_boot.sh .
chmod 644 init.qcom.post_boot.sh
exit
exit
adb reboot
I flashed the file above..the phone actually seems slower
Rather than so much editing, it is not possible to do the same using some sort of app that adjusts CPU Governor?