[Moto X Android Development] tycoo:
Reserved

Important notes / Init Script

I added an init.d script named "x_kernel_init" to tweak some settings, which is pushed into the root folder /system/etc/init.d during the installation of the kernel. Sometimes this script is not completely executed after booting the device. To be sure, that the tweaks are applied and if you want to, start the script manually via the app Kernel Adiutor (downloadable via google play or the corresponding thread here at xda).

All kernel supported settings are tweakable within this app as well, so i strongly recommend to check this out.

At the moment zram isn't enabled via the script anymore, so if you need it, you have to enable it on your own.

If you don't want any of the tweaks to be applied, just delete the script and reboot.

x_kernel_init:

#!/system/bin/sh

echo "Applying 3.4.112_x_kernel init tweaks"
echo "..."
sleep 1

#cpu interactive
if [ -d /sys/devices/system/cpu/cpufreq/interactive ]; then
echo "50" /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "918000" /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "60000" /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "80" /sys/devices/system/cpu/cpufreq/interactive/target_load
fi;

#cpu
if [ -d /sys/devices/system/cpu/cpu0/cpufreq/ ]; then
echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1728000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
fi;
if [ -d /sys/devices/system/cpu/cpu1/cpufreq/ ]; then
echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1728000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
fi;

if [ -d /sys/module/cpu_boost/parameters/ ]; then
echo "918000" /sys/module/cpu_boost/parameters/input_boost_freq
sleep 1

#cpu screen off frequency limit
if [ -d /sys/module/intelli_plug/parameters ]; then
echo "1728000" > /sys/module/intelli_plug/parameters/screen_off_max
fi;
sleep 1

#kernel samepage merging
if [ -d /sys/kernel/mm/ksm ]; then
echo "Disable kernel samepage merging"
echo 0 > /sys/kernel/mm/ksm/deferred_timer
echo 0 > /sys/kernel/mm/ksm/run
fi;
sleep 5

#VM
if [ -d /proc/sys/vm ]; then
echo "Virtual Memory settings:"
echo "Dirty Ratio = 10"
echo "Dirty Background Ratio = 75"
echo "Dirty Expire Centisecs = 380"
echo "Dirty WriteBack Centisecs = 950"
echo "Swappiness = 20"
echo "Vfs Cache Pressure = 90"
echo "10" > /proc/sys/vm/dirty_background_ratio
echo "75" > /proc/sys/vm/dirty_ratio
echo "380" > /proc/sys/vm/dirty_expire_centisecs
echo "950" > /proc/sys/vm/dirty_writeback_centisecs
echo "20" > /proc/sys/vm/swappiness
echo "90" > /proc/sys/vm/vfs_cache_pressure
fi;
sleep 1

#lowmemorykiller
if [ -d /sys/module/lowmemorykiller/parameters ]; then
echo "Enabling adaptive LowMemoryKiller"
echo "530592" > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo "Setting LowMemoryKiller Minfree to Aggressive"
echo "0,20,50,100,250,500" > /sys/module/lowmemorykiller/parameters/adj
echo "2048,4096,8192,16834,24576,32768" > /sys/module/lowmemorykiller/parameters/minfree
fi;
sleep 1

#zram
#SIZE=270
#swapoff /dev/block/zram0
#echo "Setup Zram swap device with a size of 270MB"
#echo 1 > /sys/block/zram0/reset
#echo "Set Zram max compressions streams to 8"
#echo 8 > /sys/block/zram0/max_comp_streams
#sleep 1
#if [ $SIZE -ne 0 ]; then
#	echo $(($SIZE*1024*1024)) > /sys/block/zram0/disksize
#	mkswap /dev/block/zram0
#	swapon /dev/block/zram0
#fi;
#sleep 1

echo "...finished"
sleep 3
exit