#!/system/bin/sh
# chmod -R 755 /system/etc/init.d
echo "deadline" > /sys/block/mmcblk0/queue/scheduler
echo 350 > /sys/block/mmcblk0/queue/iosched/read_expire
echo 3500 > /sys/block/mmcblk0/queue/iosched/write_expire
echo 6 > /sys/block/mmcblk0/queue/iosched/writes_starved
echo 0 > /sys/block/mmcblk0/queue/iosched/front_merges
echo 0 > /sys/block/mmcblk0/queue/iosched/fifo_batch
echo 2 > /sys/block/mmcblk0/queue/nomerge
echo 2 > /sys/block/mmcblk0/queue/rq_affinity
echo 2 > /sys/block/mmcblk0/queue/nomerges;
So everyone make sure you're testing it correctly.
I'm running our winning gov tunables as well, 15000 / 95 / 700 MHz / 45000 / 15000 / 85, which I still think are a bit snappier than the shipped defaults in r365. :)
write /sys/block/mmcblk0/queue/scheduler "deadline"
Before the iosched settings somehow make it behave, I wonder?
# wait for android os
until [ `pidof com.android.systemui` != "" ]; do
sleep 1
done;
sleep 25;
# general queue tweaks
echo 1024 > /sys/block/mmcblk0/queue/nr_requests;
echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb;
echo 2 > /sys/block/mmcblk0/queue/rq_affinity;
echo 0 > /sys/block/mmcblk0/queue/nomerges;
echo 0 > /sys/block/mmcblk0/queue/rotational;
echo 0 > /sys/block/mmcblk0/queue/iostats;
# deadline tweaks
echo 350 > /sys/block/mmcblk0/queue/iosched/read_expire;
echo 3500 > /sys/block/mmcblk0/queue/iosched/write_expire;
echo 6 > /sys/block/mmcblk0/queue/iosched/writes_starved;
echo 1 > /sys/block/mmcblk0/queue/iosched/front_merges;
echo 4 > /sys/block/mmcblk0/queue/iosched/fifo_batch;
These are the possibilities. We always used 512 rak, and nomerges and rotational have defaulted to 0 for a long time in f.K. That leaves rq nr and iostats. Franco also reverted some vm settings. Cache pressure was 300 for the longest time, for example.
on property:sys.boot_completed=1
write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay 15000
write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 95
write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 45000
write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 30000
write /sys/devices/system/cpu/cpufreq/interactive/target_loads 85
write /sys/devices/system/cpu/cpufreq/interactive/io_is_busy 1
write /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq 537600
write /sys/block/mmcblk0/queue/nr_requests 512
write /sys/block/mmcblk0/queue/read_ahead_kb 512
write /sys/block/mmcblk0/queue/rq_affinity 2
#!/system/bin/sh
# 31-Mar-2013
# custom busybox installation shortcut
bb=/sbin/bb/busybox;
# disable sysctl.conf to prevent ROM interference with tunables
# backup and replace PowerHAL with custom build to allow OC/UC to survive screen off
$bb mount -o rw,remount /system;
$bb [ -e /system/etc/sysctl.conf ] && $bb mv /system/etc/sysctl.conf /system/etc/sysctl.conf.fkbak;
$bb [ -e /system/lib/hw/power.tuna.so.fkbak ] || $bb cp /system/lib/hw/power.tuna.so /system/lib/hw/power.tuna.so.fkbak;
$bb cp /sbin/power.tuna.so /system/lib/hw/;
$bb chmod 644 /system/lib/hw/power.tuna.so;
$bb mount -o ro,remount /system;
# disable debugging
echo "0" > /sys/module/wakelock/parameters/debug_mask;
echo "0" > /sys/module/userwakelock/parameters/debug_mask;
echo "0" > /sys/module/earlysuspend/parameters/debug_mask;
echo "0" > /sys/module/alarm/parameters/debug_mask;
echo "0" > /sys/module/alarm_dev/parameters/debug_mask;
echo "0" > /sys/module/binder/parameters/debug_mask;
# general queue tweaks
for i in /sys/block/*/queue; do
echo 0 > $i/add_random;
echo 0 > $i/iostats;
echo 0 > $i/rotational;
done;
# set tweaks as scheduler defaults
scheduler=reset;
while sleep 1; do
current=`$bb cut -d\[ -f2 /sys/block/mmcblk0/queue/scheduler | $bb cut -d\] -f1`;
if [ $scheduler != $current ]; then
scheduler=$current;
if [ $scheduler == "deadline" ]; then
# deadline tweaks
echo 350 > /sys/block/mmcblk0/queue/iosched/read_expire;
echo 3500 > /sys/block/mmcblk0/queue/iosched/write_expire;
echo 4 > /sys/block/mmcblk0/queue/iosched/writes_starved;
echo 1 > /sys/block/mmcblk0/queue/iosched/front_merges;
echo 2 > /sys/block/mmcblk0/queue/iosched/fifo_batch;
elif [ $scheduler == "row" ]; then
# row tweaks
echo 100 > /sys/block/mmcblk0/queue/iosched/hp_read_quantum;
echo 75 > /sys/block/mmcblk0/queue/iosched/rp_read_quantum;
echo 5 > /sys/block/mmcblk0/queue/iosched/hp_swrite_quantum;
echo 4 > /sys/block/mmcblk0/queue/iosched/rp_swrite_quantum;
echo 4 > /sys/block/mmcblk0/queue/iosched/rp_write_quantum;
echo 3 > /sys/block/mmcblk0/queue/iosched/lp_read_quantum;
echo 12 > /sys/block/mmcblk0/queue/iosched/lp_swrite_quantum;
echo 10 > /sys/block/mmcblk0/queue/iosched/read_idle;
echo 25 > /sys/block/mmcblk0/queue/iosched/read_idle_freq;
elif [ $scheduler == "cfq" ]; then
# cfq tweaks
echo 8 > /sys/block/mmcblk0/queue/iosched/quantum;
echo 70 > /sys/block/mmcblk0/queue/iosched/fifo_expire_sync;
echo 125 > /sys/block/mmcblk0/queue/iosched/fifo_expire_async;
echo 12582912 > /sys/block/mmcblk0/queue/iosched/back_seek_max;
echo 1 > /sys/block/mmcblk0/queue/iosched/back_seek_penalty;
echo 93 > /sys/block/mmcblk0/queue/iosched/slice_sync;
echo 39 > /sys/block/mmcblk0/queue/iosched/slice_async;
echo 2 > /sys/block/mmcblk0/queue/iosched/slice_async_rq;
echo 0 > /sys/block/mmcblk0/queue/iosched/slice_idle;
echo 7 > /sys/block/mmcblk0/queue/iosched/group_idle;
echo 1 > /sys/block/mmcblk0/queue/iosched/low_latency;
fi;
fi;
# loop forever independently
done&
# lmk whitelist for common launchers
list="com.android.launcher org.adw.launcher org.adwfreak.launcher com.anddoes.launcher com.gau.go.launcherex com.mobint.hololauncher com.mobint.hololauncher.hd com.teslacoilsw.launcher com.cyanogenmod.trebuchet org.zeam";
sleep 60;
for class in $list; do
pid=`pidof $class`;
if [ $pid != "" ]; then
echo "-17" > /proc/$pid/oom_adj;
chmod 100 /proc/$pid/oom_adj;
fi;
done;
You guys rock. Thanks for all the knowledge you've shared here.
Keep it up, cheers
I think maybe we've been looking at deadline all wrong. I found lowering writes_starved improves write throughput (logically makes sense), a lower fifo_batch seems to keep the throughout smoother. Then I thought if we aren't favoring reads by starving writes anymore, perhaps we can just do it with the expires more effectively and not choke things up so severely.
So please try out 3500/750/1/1/1 and frig around with the first two numbers to see if you can find a better ratio for smoothness. For me this makes the averages in AndroBench micro test much better.
I tried equal 3500/3500 and that was slow, but 3500/500 brought the speed back then raising to 3500/750 seemed to improve throughput and reduce i/o choking.
Please try with 3500 and 3250 and let me know if you have similar results.
Also I think AndroBench and SD Card Tester are flawed. Want awesome numbers in AndroBench? Raise the write file size to 3mb and the write buffer to 8kb. SD Card Tester on the other hand seems to be unbuffered I/O which explains why it's so prone to choking.
Anyway not sure they're super amazing tunables either. Just an experiment. I got 27-28 consistently for seq read where usually I'd see 26, over 7 for both seq write and rand read where I'd usually see 6 or less, and 0.26 for rand write where it was always 0.24 before. The numbers seemed great on my end, I was more concerned with the feel being off, but if you get bad numbers then maybe we'll call the experiment failed unless you can tweak the 3500/750 for something better.