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
This commit is contained in:
Bhargav Upperla 2019-09-03 11:57:27 -07:00 committed by Max Weffers
parent 37c1eeaf40
commit 5466b0245c
No known key found for this signature in database
GPG key ID: 795F73D22FB93FAE

View file

@ -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