diff --git a/rootdir/bin/init.kernel.post_boot-lahaina.sh b/rootdir/bin/init.kernel.post_boot-lahaina.sh index f784aaa..bec5716 100755 --- a/rootdir/bin/init.kernel.post_boot-lahaina.sh +++ b/rootdir/bin/init.kernel.post_boot-lahaina.sh @@ -77,6 +77,30 @@ function configure_zram_parameters() { fi } +function configure_read_ahead_kb_values() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc) + + # Set 128 for <= 3GB & + # set 512 for >= 4GB targets. + if [ $MemTotal -le 3145728 ]; then + ra_kb=128 + else + ra_kb=512 + fi + if [ -f /sys/block/mmcblk0/bdi/read_ahead_kb ]; then + echo $ra_kb > /sys/block/mmcblk0/bdi/read_ahead_kb + fi + if [ -f /sys/block/mmcblk0rpmb/bdi/read_ahead_kb ]; then + echo $ra_kb > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb + fi + for dm in $dmpts; do + echo $ra_kb > $dm + done +} + function configure_memory_parameters() { # Set Memory parameters. # @@ -98,6 +122,7 @@ function configure_memory_parameters() { # configure_zram_parameters + configure_read_ahead_kb_values echo 0 > /proc/sys/vm/page-cluster echo 100 > /proc/sys/vm/swappiness echo 1 > /proc/sys/vm/watermark_scale_factor