From 163cec32a74e823cb18892230825684bc95097cd Mon Sep 17 00:00:00 2001 From: Arian Date: Sun, 28 Aug 2022 17:15:32 +0200 Subject: [PATCH] Revert "sm8350-common: let init do read ahead configuration" Init doesn't handle all dm devices This reverts commit 17d09b70a03a4db2b0277d52a59495f637a016f4. Change-Id: I2b42c286307e8fd41140bca8f893ccdf13ebfc06 --- rootdir/bin/init.kernel.post_boot-lahaina.sh | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) 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