# All memory configuration as following, which include ZRAM, LMK, RTCC, # KSM, and some memory properties. The configurations parameters could # auto-adaptive according to memory size. # The Value of property ro.run.ramconfig should be {ro.ramsize} / 256, but if diff # ro.ramsize use the same memory configuration parameters, the Value ro.run.ramconfig # should be the same. such as 512M, 768M use the same configurations parameters. # # NOTE : IF Add new ro.run.ramconfig, PLEASE copy the configurations # between BEGIN line and END line, Then change the parameters that you want. on early-boot chown system root /sys/class/rtcc/rtcc_trigger # Table ro.ramsize mapping to ro.run.ramconfig on property:ro.ramsize=512M setprop ro.run.ramconfig 2 on property:ro.ramsize=768M setprop ro.run.ramconfig 2 on property:ro.ramsize=1024M setprop ro.run.ramconfig 4 on property:ro.ramsize=1536M setprop ro.run.ramconfig 4 on property:ro.ramsize=2048M setprop ro.run.ramconfig 4 ######## ramconfig=2,3 memory parameter configurations BEGIN ####### on property:ro.run.ramconfig=2 setprop ro.config.low_ram true #Set ZRAM configure parameters setprop zram.disksize 400 write /proc/sys/vm/extra_free_kbytes 10240 #Set LMK watermark as {18M,30M,54M,66M,78M,90M} write /sys/module/lowmemorykiller/parameters/adj 0,100,200,600,900,906 write /sys/module/lowmemorykiller/parameters/minfree 4608,7680,13824,16896,30720,38400 setprop sys.lmk.adj "0,100,200,600,900,906" setprop sys.lmk.minfree "4608,7680,13824,16896,30720,38400" setprop lmk.autocalc false #Enable KSM and ZRAM setprop ro.config.ksm.support true setprop ro.config.zram.support true ######## ramconfig=2,3 memory parameter configurations END ######### ######## ramconfig=4,6,8 memory parameter configurations BEGIN ####### on property:ro.run.ramconfig=4 setprop ro.config.low_ram false #Set ZRAM configure parameters setprop zram.disksize 600 write /proc/sys/vm/extra_free_kbytes 4096 #Set LMK watermark as {45M,54M,63M,72M,80M,92MB} write /sys/module/lowmemorykiller/parameters/adj 0,100,300,800,900,906 write /sys/module/lowmemorykiller/parameters/minfree 11520,13824,16128,18432,36864,46080 setprop sys.lmk.adj "0,100,300,800,900,906" setprop sys.lmk.minfree "11520,13824,16128,18432,36864,46080" setprop lmk.autocalc false #Set RTCC minfree watermarks as {224M,192M,160M,128M,96M} write /sys/module/rtcc/parameters/minfree 57344,49152,40960,32768,24576 #Enable ZRAM setprop ro.config.zram.support true ######## ramconfig=4,6,8 memory parameter configurations END ######### #Configurate ZRAM, then start zram service on property:ro.config.zram.support=true setprop sys.vm.swappiness 30 write /proc/sys/vm/page-cluster 0 start zram #Configurate KSM, then run KSM on property:ro.config.ksm.support=true write /sys/kernel/mm/ksm/pages_to_scan 100 write /sys/kernel/mm/ksm/sleep_millisecs 500 write /sys/kernel/mm/ksm/run 1