From 5466b0245cfaf04a1f847c31a62c65b021f799d5 Mon Sep 17 00:00:00 2001 From: Bhargav Upperla Date: Tue, 3 Sep 2019 11:57:27 -0700 Subject: [PATCH] sdm660: Increase ZRAM swap size. On high RAM targets, due to more anonymous memory availability, we can improve headroom by increasing ZRAM swap size, especially under memory pressure, and during background app compact. Also ZRAM swap size is logical and is used when needed and shouldn't cause other side effects. Change-Id: I11949b8bdf16e9b4b8abb1bd633ffa1a1c0b1ad6 --- rootdir/bin/init.qcom.post_boot.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rootdir/bin/init.qcom.post_boot.sh b/rootdir/bin/init.qcom.post_boot.sh index 6d96bbf2..2a29f60c 100755 --- a/rootdir/bin/init.qcom.post_boot.sh +++ b/rootdir/bin/init.qcom.post_boot.sh @@ -340,7 +340,9 @@ function configure_zram_parameters() { # Zram disk - 75% for Go devices. # For 512MB Go device, size = 384MB, set same for Non-Go. # For 1GB Go device, size = 768MB, set same for Non-Go. - # For >=2GB Non-Go device, size = 1GB + # For >1GB and <=3GB Non-Go device, size = 1GB + # For >3GB and <=4GB Non-Go device, size = 2GB + # For >4GB Non-Go device, size = 4GB # And enable lz4 zram compression for Go targets. if [ "$low_ram" == "true" ]; then @@ -355,9 +357,12 @@ function configure_zram_parameters() { echo 402653184 > /sys/block/zram0/disksize elif [ $MemTotal -le 1048576 ]; then echo 805306368 > /sys/block/zram0/disksize - else - # Set Zram disk size=1GB for >=2GB Non-Go targets. + elif [ $MemTotal -le 3145728 ]; then echo 1073741824 > /sys/block/zram0/disksize + elif [ $MemTotal -le 4194304 ]; then + echo 2147483648 > /sys/block/zram0/disksize + else + echo 4294967296 > /sys/block/zram0/disksize fi mkswap /dev/block/zram0 swapon /dev/block/zram0 -p 32758