Here is a tweak that I use in my ROMs that adjusts the individual caches for the ram/disk partitions. I have adjusted it to work with the nexus 10. Depending on your minfree settings you may need to change the size because they work hand in hand. Right now they are set to 2048k, but values anywhere from 256k to 8192k can make a huge difference depending on your setup. 128k is default. Add it to an init.d file.
echo 2048 > /sys/devices/virtual/bdi/0:18/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/0:19/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:1/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:2/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:3/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:4/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:5/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:6/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:7/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:9/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:10/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:11/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:12/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:13/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:14/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/1:15/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:1/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:2/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:3/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:4/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:5/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:6/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:7/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:9/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:10/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:11/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:12/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:13/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:14/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:15/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:16/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:17/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:18/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:19/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:20/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:21/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:22/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:23/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:24/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:25/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:26/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:27/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:28/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:29/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:30/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:31/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:32/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:33/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:34/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:35/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:36/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:37/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/7:38/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:16/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/253:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:1/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:2/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:3/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:4/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:5/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:6/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:7/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:9/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:10/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:11/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:12/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:13/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:14/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:15/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:16/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:17/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:18/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:19/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:20/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:21/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:22/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:23/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:24/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:25/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:26/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:27/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:28/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:29/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:30/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:31/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:32/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:33/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:34/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:35/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:36/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:37/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/254:38/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/default/read_ahead_kb
I was hoping someone else would ask this so I dont look dumb, but do we really have that many partitions in our storage? Or are all those lines just there so that if a partition happens to be created at some point with the next un-used ID in our tablets list then it will still be taken care of by this script?
{
"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"
}
ROM Toolbox can set the SD Boost feature also (Pro can anyway, not 100% sure on Free version). 4096kb does appear to get the best results though, and default is indeed 128kb
espionage724 said:
ROM Toolbox can set the SD Boost feature also (Pro can anyway, not 100% sure on Free version). 4096kb does appear to get the best results though, and default is indeed 128kb
Click to expand...
Click to collapse
It only adjusts these lines:
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:8/read_ahead_kb
echo 2048 > /sys/devices/virtual/bdi/179:16/read_ahead_kb
Which in other devices controls the SD card cache. My tweaks adjusts the cache for the entire system.
EniGmA1987 said:
I was hoping someone else would ask this so I dont look dumb, but do we really have that many partitions in our storage? Or are all those lines just there so that if a partition happens to be created at some point with the next un-used ID in our tablets list then it will still be taken care of by this script?
Click to expand...
Click to collapse
Go here and have a look for yourself : /sys/devices/virtual/bdi/
HBBTweaks is a package of Kernel and build.prop tweaks I've done (read, tested, benchmarked, saw the sources, etc) and shared on a Facebook group since version 1 (long time ago huh?)
Lots of users tested and most of them noticed improvements in battery life *and* performance, so I decided to publish here as you may find it helpful too..
It is just a .zip file you can install with CWM or TWRP the same way as you install a ROM. It should work on ALL ROMs but *I* have only tested it with CM10.x and CM11 ones. Don't worry, if anything goes wrong you can easily uninstall it and everything will be reverted.
WARNING: it will activate some overclocking (cpu: 1050mhz, gpu: 700mhz) and undervolting *if* your Kernel is able to, so your phone may get unstable if it's not as GOOD as mine, LOL.
If you get some reboots after installing it, try the alternate versions.. First try a1, then try a2. They won't save as MUCH battery as the original one but you'll definitively notice improvements as this isn't just a "switch-on-the-OC script" !!
Download link: http://d-h.st/iuT (Multi-installer, with two "alternate" versions and uninstaller included)
See if your phone gets a bit more responsive and if your battery life is better then post your thoughts here
CHANGELOG
31 -> 32
abyssplug or pegasusqplus as default
faster gpu clock reaction
sqlite3 and zipalign updated
touchboost to 800mhz with 200ms duration (default was 500ms)
higher intervals for the kernel scheduler
won't save any modified data to mmc/sd for up to 5m
tweaked abyssplug and pegasusq
won't disable zram, instead will use it more if it's already enabled
30 -> 31
sqlite3 included to optimize some databases
other minor tweaks
don't forget to reinstall it after any rom update!
29 -> 30
it tries to disable zram giving better performance and battery
ext4 and sioplus tweaks!
abyssplug by default, tweaked also
28 -> 29
kernel's sched_* back to default. better performance
testing some ext4 tweaks
27 -> 28
Aroma installer providing 2 alternate installation options and an uninstaller.
10.1 (and MIUI) compatible
Different swappiness and page-cluster values for zRam swapping or "normal" swapping
ddr_opp set to 100%, don't know if it will stick. it's faster here.
tweaked the way minfree is set and also the mounting options
26 -> 27
A typo (while I was translating) was preventing undervolting.. that's why nobody complained about reboots with the full version.. lol
XDA:DevDB Information
HBBTweaks, Tool/Utility for the Samsung Galaxy S Advance I9070
Contributors
fbs
Version Information
Status: Testing
Created 2014-06-16
Last Updated 2014-11-25
Works on JB roms too ?
Normally I can't overclock, it causes the known freezes and reboot issues.
So which verison should I pick? Alternate 1 or Alternate 2?
danielbulan97 said:
Works on JB roms too ?
Click to expand...
Click to collapse
It should..
coffeecore said:
Normally I can't overclock, it causes the known freezes and reboot issues.
So which verison should I pick? Alternate 1 or Alternate 2?
Click to expand...
Click to collapse
It's not a big overclock to the cpu(it's limited to 1050mhz), it's mostly to the gpu.. so, I think you could try the original one and then a1.. come on, the files are so small..
fbs said:
It's not a big overclock to the cpu(it's limited to 1050mhz), it's mostly to the gpu.. so, I think you could try the original one and then a1.. come on, the files are so small..
Click to expand...
Click to collapse
Haha I know, sorry for my lazyness :cyclops:
Edit: You should/can mention in the OP that OC is limited to 1050mhz.
I will download and try!
I am using Resurection Remix. The rom is awesome but i am having some battery drains..
I will try this tweaks for some days and test if the battery goes better
thanks!
@fbs Thanks man, tried original one and everything is fine. Waiting a couple of days for making a correct review. One question, I set CPU to 1000 (max.) and after that I flashed your script. When looking for which states my processor has been on there is 1000 Mhz the highest (I've set this before flashing script) but is my CPU actually running on 1050mhz? Would like to know more about this script
Thanks anyway, it's nice :thumbup:
PS; On what ROM are you now?
sent with my S Advance.
coffeecore said:
@fbs Thanks man, tried original one and everything is fine. Waiting a couple of days for making a correct review. One question, I set CPU to 1000 (max.) and after that I flashed your script. When looking for which states my processor has been on there is 1000 Mhz the highest (I've set this before flashing script) but is my CPU actually running on 1050mhz? Would like to know more about this script
PS; On what ROM are you now?
Click to expand...
Click to collapse
Well it sets max frequency to 1050 right after booting, but if your ROM or any app (like No-Frills) set it back to 1000, it will keep on 1000.
Right now I'm using Paranoid 4.4 build by t4n017 available here.. it's faster than vanilla cm11 and Vanir, to me..
v26 changelog?
moscka said:
v26 changelog?
Click to expand...
Click to collapse
Did you use V25 ?
Is KitKat based custom ROM supported?
Is KitKat based custom ROM supported? TQ.
xbean said:
Is KitKat based custom ROM supported? TQ.
Click to expand...
Click to collapse
Yes
I'll give it a try tomorrow.
coffeecore said:
Yes
Click to expand...
Click to collapse
Thanks. I'll give it a try tomorrow. Cheers.
King ov Hell said:
Did you use V25 ?
Click to expand...
Click to collapse
Yes, I was on v25.
The system is a little snappier, but the most noticeable change is the battery save (undervolting).
I got 4h and 30m of screen on and my battery is not good. I have it for 18 months.
I'm on PA 4.4.3.
Essential
II'm using this tweak since version 23. Currently use version 26 alt1 with Vanir 4.4.3 ROM and everything is running perfectly. Really feel improvements in battery performance and the performance of the device. :good::good::good::good::good:
Thank U Bro.
and what about the battery life
mhmod222 said:
and what about the battery life
Click to expand...
Click to collapse
Try it out, it is worth it man :good:
---------- Post added at 11:57 PM ---------- Previous post was at 11:21 PM ----------
@fbs
It is not recommended to flash this script right after flashing ROM and Gapps, right?
Booting is a requirement.
coffeecore said:
Try it out, it is worth it man :good:
---------- Post added at 11:57 PM ---------- Previous post was at 11:21 PM ----------
@fbs
It is not recommended to flash this script right after flashing ROM and Gapps, right?
Booting is a requirement.
Click to expand...
Click to collapse
You can flash it any time. Don't need to boot after initial ROM/GApps flash.. :good:
It just won't work if you install it BEFORE the ROM itself as the ROM's installer will format /system and everything will be lost
If anyone's interested, here are the two main "scripts" my tweak uses. Anyone could read it inside the .zip or /system/etc/init.d folder, but I know some are lazy then I'll copy/paste here
#!/system/bin/sh
#hbbtweaksv27
echo z1hbbkern START
#activate KSM, but less pages in a bunch to prevent lagging
echo 51 > /sys/kernel/mm/ksm/sleep_millisecs;
echo 29 > /sys/kernel/mm/ksm/pages_to_scan;
echo 1 > /sys/kernel/mm/ksm/run;
#and activate uksm if it has it
echo 1 > /sys/kernel/mm/uksm/run;
echo medium > /sys/kernel/mm/uksm/cpu_governor;
echo 439 > /sys/kernel/mm/uksm/sleep_millisecs;
#I read somewhere 5ms should be the maximum for a dual-core, our default was 10ms
echo "3999971" > /proc/sys/kernel/sched_latency_ns;
echo "1000003" > /proc/sys/kernel/sched_shares_window;
#higher avg time, maybe lessen the overhead
echo "2003" > /proc/sys/kernel/sched_time_avg;
#1.5ms was the minimum time a thread could be on cpu.
#I think it's too much time, lowered to 0,1ms. Same for threads that are waking up
echo "100003" > /proc/sys/kernel/sched_wakeup_granularity_ns;
echo "100003" > /proc/sys/kernel/sched_min_granularity_ns;
echo "150000" > /proc/sys/kernel/sched_migration_cost;
#a forked thread should run right after
echo 1 > /proc/sys/kernel/sched_child_runs_first;
echo 0 > /proc/sys/kernel/sched_tunable_scaling;
#won't enforce a time for real-time tasks.. maybe lessen the overhead?
echo -1 > /proc/sys/kernel/sched_rt_runtime_us;
echo 2000000 > /proc/sys/kernel/sched_rt_period_us;
#updated file-data that's cached in ram will stay on it 63s before being written
echo "6317" > /proc/sys/vm/dirty_writeback_centisecs;
echo "6317" > /proc/sys/vm/dirty_expire_centisecs;
#but if we have dynamic writebacks, it will stay only 3s when display is active and 123s when not
echo "317" > /proc/sys/vm/dirty_writeback_active_centisecs;
echo "12301" > /proc/sys/vm/dirty_writeback_suspend_centisecs;
#let's almost deactivate swapping, our "disc" is ultra-super-slow!
echo "1" > /proc/sys/vm/swappiness;
#let's fix the amount of memory that could be dirty before it start writing to mmc
echo "8000000" > /proc/sys/vm/dirty_background_bytes;
#let's fix the maximum amount of memory an app can defile before it get blocked
echo "14000000" > /proc/sys/vm/dirty_bytes;
#4mb really "free", not even used for caching
echo 4096 > /proc/sys/vm/min_free_kbytes;
#1=same amount for every zone.. (?)
echo 1 > /proc/sys/vm/min_free_order_shift;
#3s frequency for stats. idk if there's any drawbacks
echo 3 > /proc/sys/vm/stat_interval;
echo 0 > /proc/sys/vm/highmem_is_dirtyable;
echo "30" > /proc/sys/kernel/panic;
echo "0" > /proc/sys/kernel/panic_on_oops;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
#swap as little as possible in a bunch
echo "1" > /proc/sys/vm/page-cluster;
#less wait time, less complexity.. less memory, less packet size
echo 5 > /proc/sys/net/ipv4/tcp_fin_timeout;
echo 1 > /proc/sys/net/ipv4/tcp_timestamps;
echo 5 > /proc/sys/net/ipv4/tcp_challenge_ack_limit;
echo 1 > /proc/sys/net/ipv4/tcp_sack;
echo 0 > /proc/sys/net/ipv4/tcp_dsack;
echo 64 > /proc/sys/net/ipv4/tcp_base_mss;
echo 0 > /proc/sys/net/ipv4/tcp_retrans_collapse;
echo 0 > /proc/sys/net/ipv4/tcp_abc;
echo 0 > /proc/sys/net/ipv4/tcp_mtu_probing;
echo 0 > /proc/sys/net/ipv4/tcp_ecn;
echo 21 > /proc/sys/net/ipv4/tcp_reordering;
echo 262144 > /proc/sys/net/core/wmem_default;
echo 262144 > /proc/sys/net/core/rmem_default;
echo 1 > /proc/sys/net/ipv4/tcp_no_metrics_save;
echo 512 1024 4096 > /proc/sys/net/ipv4/tcp_mem;
echo illinois > /proc/sys/net/ipv4/tcp_congestion_control;
#max of 4mb for net reads and writes, should be enough
echo 4194304 > /proc/sys/net/core/rmem_max;
echo 4194304 > /proc/sys/net/core/wmem_max;
#abb-codec audio: higher gains and low power mode activated
echo on > /sys/kernel/abb-codec/anagain3;
echo gain=0 > /sys/kernel/abb-codec/anagain3;
echo on > /sys/kernel/abb-codec/hsldiggain;
echo gain=0 > /sys/kernel/abb-codec/hsldiggain;
echo on > /sys/kernel/abb-codec/hsrdiggain;
echo gain=0 > /sys/kernel/abb-codec/hsrdiggain;
echo on > /sys/kernel/abb-codec/hslowpow;
echo mode=1 > /sys/kernel/abb-codec/hslowpow;
echo on > /sys/kernel/abb-codec/hsdaclowpow;
echo mode=1 > /sys/kernel/abb-codec/hsdaclowpow;
echo on > /sys/kernel/abb-codec/hshpen;
echo mode=1 > /sys/kernel/abb-codec/hshpen;
echo on > /sys/kernel/abb-codec/classdhpg;
echo gain=10 > /sys/kernel/abb-codec/classdhpg;
echo on > /sys/kernel/abb-codec/classdwg;
echo gain=10 > /sys/kernel/abb-codec/classdwg;
echo on > /sys/kernel/abb-codec/addiggain2;
echo gain=4 > /sys/kernel/abb-codec/addiggain2;
echo on > /sys/kernel/abb-codec/eardiggain;
echo gain=0 > /sys/kernel/abb-codec/eardiggain;
echo 1 > /sys/kernel/abb-codec/chargepump;
#ramp to 800mhz when you touch the screen
echo on > /sys/kernel/mxt224e/touchboost;
echo 800000 > /sys/kernel/mxt224e/touchboost_freq;
#no fsync.
echo 1 > /sys/kernel/fsync/mode;
#mali (gpu) stuff
echo 0 > /sys/module/mali/parameters/mali_debug_level;
echo 6 > /sys/module/mali/parameters/mali_oskmem_allocorder;
#439ms instead of 1s to verify mali(gpu)'s usage
echo 439 > /sys/module/mali/parameters/mali_utilization_sampling_rate;
echo 439 > /sys/module/mali/parameters/mali_pm_sampling_rate;
echo 50331648 > /sys/module/mali/parameters/pre_allocated_memory_size_max;
echo 48 > /sys/module/mali/parameters/mali_l2_max_reads;
echo 0 > /sys/module/mali/parameters/mali_pp_scheduler_balance_jobs;
#our cpu's own powersaving is buggy and we have pegasusq
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings;
echo 0 > /sys/module/dhd/parameters/dhdpm_fast;
echo 4 > /d/cpuidle/deepest_state;
#don't try to squeeze too much or too frequently (?) lessen overhead (?)
echo 64 > /sys/module/lowmemorykiller/parameters/cost;
#order of death! starting from right to left in number of pages
#first it will kill empty apps when we have less than 30720x4096 (120MB) of free ram
minfree=16384,18432,20480,24576,26624,30720;
lmk=/sys/module/lowmemorykiller/parameters/minfree;
minboot=`cat $lmk`;
while sleep 10; do
if [ `cat $lmk` != $minboot ]; then
[ `cat $lmk` != $minfree ] && echo $minfree > $lmk || exit;
fi;
done&
#I really don't know if these will help to lessen overhead or lessen lags, but....
sysctl -w vm.extfrag_threshold=800;
sysctl -w kernel.randomize_va_space=0;
echo 128 > /proc/sys/kernel/random/read_wakeup_threshold;
echo 256 > /proc/sys/kernel/random/write_wakeup_threshold;
#let's use pegasusq as governor as it's multi-core AWARE and it shut downs our second cpu
echo pegasusq > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
governor=reset;
while true; do
current=`cut -d\[ -f2 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | cut -d\] -f1`;
if [ $governor != $current ]; then
governor=$current;
if [ $governor == "pegasusq" ]; then
echo 40000 > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate;
echo 400000 > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness;
echo 70 > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold_at_min_freq;
echo 99 > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold;
echo 20 > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential;
echo 20 > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step;
echo 800000 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_1_1;
echo 400000 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_freq_2_0;
echo 300 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_1_1;
echo 110 > /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_rq_2_0;
echo 3 > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor;
fi;
if [ $governor == "lulzactiveq" ]; then
echo 3 > /sys/devices/system/cpu/cpufreq/lulzactiveq/screen_off_min_step;
echo 90 > /sys/devices/system/cpu/cpufreq/lulzactiveq/inc_cpu_load;
echo 40 > /sys/devices/system/cpu/cpufreq/lulzactiveq/dec_cpu_load;
echo 80000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/up_sample_time;
echo 80000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/down_sample_time;
echo 120000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_sampling_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/lulzactiveq/cpu_up_rate;
echo 2 > /sys/devices/system/cpu/cpufreq/lulzactiveq/cpu_down_rate;
echo 1 > /sys/devices/system/cpu/cpufreq/lulzactiveq/pump_up_step;
echo 1 > /sys/devices/system/cpu/cpufreq/lulzactiveq/pump_down_step;
echo 800000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_freq_1_1;
echo 400000 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_freq_2_0;
echo 300 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_rq_1_1;
echo 110 > /sys/devices/system/cpu/cpufreq/lulzactiveq/hotplug_rq_2_0;
fi;
fi;
sleep 809;
done&
#no sleepers seems to help. others are experimental
mount -t debugfs none /sys/kernel/debug;
echo "ARCH_POWER" > /sys/kernel/debug/sched_features;
echo "NO_GENTLE_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NORMALIZED_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_START_DEBIT" > /sys/kernel/debug/sched_features;
echo "NO_NEXT_BUDDY" > /sys/kernel/debug/sched_features;
echo "NONTASK_POWER" > /sys/kernel/debug/sched_features;
echo "AFFINE_WAKEUPS" > /sys/kernel/debug/sched_features;
#let's force the system user interface to have higher priority
while sleep 1; do
if [ `pidof com.android.systemui` ]; then
systemui=`pidof com.android.systemui`;
busybox renice -18 $systemui;
echo -17 > /proc/$systemui/oom_adj;
chmod 100 /proc/$systemui/oom_adj;
exit;
fi;
done&
#and some launchers too
list="com.android.launcher org.adw.launcher org.adwfreak.launcher com.anddoes.launcher com.android.lmt com.chrislacy.actionlauncher.pro com.cyanogenmod.trebuchet com.gau.go.launcherex com.mobint.hololauncher com.mobint.hololauncher.hd com.teslacoilsw.launcher com.tsf.shell org.zeam";
while sleep 60; do
for class in $list; do
if [ `pgrep $class` ]; then
launcher=`pgrep $class`;
echo -17 > /proc/$launcher/oom_adj;
chmod 100 /proc/$launcher/oom_adj;
busybox renice -18 $launcher;
fi;
done;
exit;
done&
echo hbbkern: adjusting frequencies and voltages/undervolt
########################## OVERCLOCK & UNDERVOLT. The alternate versions changes these!
#and you can change it too. higher VARM = higher voltage. in hexadecimal
#This is ULTRA-STABLE on my phone but yours are not like mine..
#################
#overclock gpu if needed
echo 1 > /sys/kernel/mali/mali_auto_boost;
#720mhz while "boosted" (idx 22)
echo idx=22 > /sys/kernel/mali/mali_boost_high;
#300mhz while not (idx 2)
echo idx=2 > /sys/kernel/mali/mali_boost_low;
#let's scale from 200mhz to 1050mhz
echo 200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 1050000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
#200mhz
echo varm=0x10 > /sys/kernel/liveopp/arm_step0;
echo set_volt=1 > /sys/kernel/liveopp/arm_step0;
#400mhz
echo varm=0x10 > /sys/kernel/liveopp/arm_step1;
echo set_volt=1 > /sys/kernel/liveopp/arm_step1;
#600mhz
echo varm=0x19 > /sys/kernel/liveopp/arm_step2;
echo set_volt=1 > /sys/kernel/liveopp/arm_step2;
#800mhz
echo varm=0x22 > /sys/kernel/liveopp/arm_step3;
echo set_volt=1 > /sys/kernel/liveopp/arm_step3;
#1000mhz
echo varm=0x2C > /sys/kernel/liveopp/arm_step4;
echo set_volt=1 > /sys/kernel/liveopp/arm_step4;
#1050mhz
echo varm=0x2E > /sys/kernel/liveopp/arm_step5;
echo set_volt=1 > /sys/kernel/liveopp/arm_step5;
echo z1hbbkern END
#!/system/bin/sh
#hbbtweaksv27
echo z2hbbmounts START
tune2fs -o journal_data_writeback /dev/block/mmcblk0p4
tune2fs -o journal_data_writeback /dev/block/mmcblk0p5
tune2fs -O ^has_journal /dev/block/mmcblk0p4
tune2fs -O ^has_journal /dev/block/mmcblk0p5
sleep 31;
#let's not update access time for each file/folder accessed (noatime, nodiratime)
#let's write only after 61 secs instead of 5
#"writeback" is the fastest metadata writing mode and "discard" will clean erased zones providing better writting performance after
busybox mount -o remount,noatime,nodiratime,rw,barrier=1,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=61 /data /data;
busybox mount -o remount,noatime,nodiratime,rw,barrier=0,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=67 /cache /cache;
#quem sabe tenha writeback?
busybox mount -o remount,noatime,nodiratime,data=writeback,rw,barrier=0,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=61 /cache /cache;
busybox mount -o remount,noatime,nodiratime,data=writeback,rw,barrier=1,noauto_da_alloc,discard,delalloc,nobh,nodev,nosuid,commit=67 /data /data;
for k in $(busybox mount | grep relatime | cut -d " " -f3); do busybox mount -o remount,noatime,nodiratime $k $k; done;
echo 15 > /proc/sys/fs/lease-break-time;
sleep 31;
#let's cache 2000 writes/reads requests
#no merging and no scheduler if not writing to a real mmc (less overhead?)
#NO read_ahead seems controversial.. but we shouldn't waste our time trying to read
# and fillin our ram with unrequested data
for i in $(busybox find /sys/devices -name queue);
do
echo 2000 > $i/nr_requests;
echo 2 > $i/rq_affinity;
echo 2 > $i/nomerges;
echo 0 > $i/rotational;
echo 0 > $i/add_random;
echo 0 > $i/iostats;
echo noop > $i/scheduler;
echo 0 > $i/read_ahead_kb;
done;
#for mmcs it will merge and try to use sioplus as scheduler..
for i in $(busybox find /sys/devices -name queue |grep mmc);
do
echo 0 > $i/nomerges;
echo row > $i/scheduler;
echo sio > $i/scheduler;
echo sioplus > $i/scheduler;
echo 0 > $i/read_ahead_kb;
done;
#in doubt about it for the external one
echo "128" > /sys/devices/virtual/bdi/179:96/read_ahead_kb;
CI() {
echo $1 > /sys/block/mmcblk0/queue/iosched/$2
echo $1 > /sys/block/mmcblk1/queue/iosched/$2
}
#scheduler tweaks
scheduler=reset;
while sleep 461; do
current=`cut -d\[ -f2 /sys/block/mmcblk0/queue/scheduler | cut -d\] -f1`;
if [ $scheduler != $current ]; then
scheduler=$current;
if [ $scheduler == "deadline" ]; then
CI 200 read_expire;
CI 500 write_expire;
CI 4 writes_starved;
CI 0 front_merges;
CI 8 fifo_batch;
elif [ $scheduler == "row" ]; then
CI 100 hp_read_quantum;
CI 75 rp_read_quantum;
CI 3 lp_read_quantum;
CI 6 hp_swrite_quantum;
CI 5 rp_swrite_quantum;
CI 4 rp_write_quantum;
CI 12 lp_swrite_quantum;
CI 10 read_idle;
CI 15 read_idle_freq;
elif [ $scheduler == "cfq" ]; then
CI 4 quantum;
CI 80 fifo_expire_sync;
CI 330 fifo_expire_async;
CI 12582912 back_seek_max;
CI 1 back_seek_penalty;
CI 60 slice_sync;
CI 50 slice_async;
CI 2 slice_async_rq;
CI 0 slice_idle;
CI 0 group_idle;
CI 1 low_latency;
fi;
fi;
done&
#nada de gastar memoria com internet, nossas conexoes sao ultra-lentas
setprop net.tcp.buffersize.evdo ""
setprop net.tcp.buffersize.evdo_b ""
setprop net.tcp.buffersize.gprs ""
setprop net.tcp.buffersize.hsdpa ""
setprop net.tcp.buffersize.hspa ""
setprop net.tcp.buffersize.hspap ""
setprop net.tcp.buffersize.hsupa ""
setprop net.tcp.buffersize.edge ""
setprop net.tcp.buffersize.umts ""
setprop net.tcp.buffersize.dchspap ""
setprop net.tcp.buffersize.lte ""
setprop net.tcp.buffersize.default 1024,32768,1048576,1024,4096,65536
setprop net.tcp.buffersize.wifi 4096,524288,1048576,4096,1048576,4194304
echo z2hbbmounts END
sleep 2;
#DROP all cached stuff till now. We won't need again all stuff that have been read while booting
sync;
sysctl -w vm.drop_caches=3;