sdm660-common: Override readahead to 128KiB after post-boot

* Qualcomm decided to increase the read-ahead value to 512KiB [1].

 * This value resulted in frequent cases where read-ahead
   would be waiting for new I/O requests and thus ending
   up being synchronous rather than asynchronous.

 * As result, the main goal of Qualcomm's patch [1] which
   is to increase throughput ends up in a regression where
   read throughput is significantly lower than it ever
   would be with the recommended [2] read-ahead value.

 * This patch uses our existing loop in ramdisk to set
   the read-ahead value to 128KiB.

[1] https://source.codeaurora.org/quic/la/kernel/msm-4.19/commit/include/linux/mm.h?h=LA.UM.9.12.r1-09000-SMxx50.0&id=25d04e4ceb7c067907901842c223d62973d73a75
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/mm.h?h=v4.19.160#n2397

Change-Id: I1980d904568fe4f1ce7b676452bcc44e4689f02f
Co-authored-by: clarencelol <clarencekuiek@icloud.com>
This commit is contained in:
Alex Naidis 2021-04-14 21:30:34 +08:00 committed by OdSazib
parent 4eb8bd1b7c
commit 564ddb664d
No known key found for this signature in database
GPG key ID: D4CC9F3E8190970A
2 changed files with 5 additions and 18 deletions

View file

@ -370,12 +370,8 @@ function configure_zram_parameters() {
}
function configure_read_ahead_kb_values() {
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
# Set 128 for <= 3GB &
# set 512 for >= 4GB targets.
if [ $MemTotal -le 3145728 ]; then
# Set 128 for all targets
echo 128 > /sys/block/mmcblk0/bdi/read_ahead_kb
echo 128 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 128 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb
@ -383,15 +379,6 @@ function configure_read_ahead_kb_values() {
echo 128 > /sys/block/dm-0/queue/read_ahead_kb
echo 128 > /sys/block/dm-1/queue/read_ahead_kb
echo 128 > /sys/block/dm-2/queue/read_ahead_kb
else
echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 512 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb
echo 512 > /sys/block/mmcblk0rpmb/queue/read_ahead_kb
echo 512 > /sys/block/dm-0/queue/read_ahead_kb
echo 512 > /sys/block/dm-1/queue/read_ahead_kb
echo 512 > /sys/block/dm-2/queue/read_ahead_kb
fi
}
function disable_core_ctl() {

View file

@ -413,10 +413,10 @@ on property:persist.vendor.ssr.enable_ramdumps=0
on property:sys.boot_completed=1
write /dev/kmsg "Boot completed "
#Reset read ahead for dm-0, dm-1 and dm-2 to 512kb
write /sys/block/dm-0/queue/read_ahead_kb 512
write /sys/block/dm-1/queue/read_ahead_kb 512
write /sys/block/dm-2/queue/read_ahead_kb 512
#Reset read ahead for dm-0, dm-1 and dm-2 to 128kb
write /sys/block/dm-0/queue/read_ahead_kb 128
write /sys/block/dm-1/queue/read_ahead_kb 128
write /sys/block/dm-2/queue/read_ahead_kb 128
#WDSP FW boot sysfs node used by STHAL
chown media audio /sys/kernel/wdsp0/boot
chown media audio /sys/kernel/wcd_cpe0/fw_name