post_boot: updating post_boot for <=2 GB devices

Removing the check of 1GB RAM while enabling
low_ram target specific configurations to enable them
for 2GB RAM targets as well.
Updating ZRAM size to 75% of RAM for <2GB devices

Change-Id: I8d5341a4397cd20f2c59e7396801fcbea7fe5b73
This commit is contained in:
Divyanand Rangu 2020-03-31 19:35:33 +05:30 committed by OdSazib
parent 7bacadf2fb
commit 28e54cf755
No known key found for this signature in database
GPG key ID: CB336514F9F5CF69

View file

@ -546,12 +546,19 @@ 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 devices, size = 50% of RAM size. Limit the size to 4GB.
# For 2GB Go device, size = 1536MB, set same for Non-Go.
# For >2GB Non-Go devices, size = 50% of RAM size. Limit the size to 4GB.
# And enable lz4 zram compression for Go targets.
RamSizeGB=`echo "($MemTotal / 1048576 ) + 1" | bc`
zRamSizeBytes=`echo "$RamSizeGB * 1024 * 1024 * 1024 / 2" | bc`
zRamSizeMB=`echo "$RamSizeGB * 1024 / 2" | bc`
if [ $RamSizeGB -le 2 ]; then
zRamSizeBytes=`echo "$RamSizeGB * 1024 * 1024 * 1024 * 3 / 4" | bc`
zRamSizeMB=`echo "$RamSizeGB * 1024 * 3 / 4" | bc`
else
zRamSizeBytes=`echo "$RamSizeGB * 1024 * 1024 * 1024 / 2" | bc`
zRamSizeMB=`echo "$RamSizeGB * 1024 / 2" | bc`
fi
# use MB avoid 32 bit overflow
if [ $zRamSizeMB -gt 4096 ]; then
zRamSizeBytes=4294967296
@ -565,13 +572,7 @@ function configure_zram_parameters() {
if [ -f /sys/block/zram0/use_dedup ]; then
echo 1 > /sys/block/zram0/use_dedup
fi
if [ $MemTotal -le 524288 ]; then
echo 402653184 > /sys/block/zram0/disksize
elif [ $MemTotal -le 1048576 ]; then
echo 805306368 > /sys/block/zram0/disksize
else
echo $zRamSizeBytes > /sys/block/zram0/disksize
fi
echo $zRamSizeBytes > /sys/block/zram0/disksize
# ZRAM may use more memory than it saves if SLAB_STORE_USER
# debug option is enabled.
@ -671,11 +672,9 @@ if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] || [ "$Produc
echo 100 > /proc/sys/vm/swappiness
else
arch_type=`uname -m`
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
# Set parameters for 32-bit Go targets.
if [ $MemTotal -le 1048576 ] && [ "$low_ram" == "true" ]; then
if [ "$low_ram" == "true" ]; then
# Disable KLMK, ALMK, PPR & Core Control for Go devices
echo 0 > /sys/module/lowmemorykiller/parameters/enable_lmk
echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk