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:
parent
7bacadf2fb
commit
28e54cf755
1 changed files with 12 additions and 13 deletions
|
@ -546,12 +546,19 @@ function configure_zram_parameters() {
|
||||||
# Zram disk - 75% for Go devices.
|
# Zram disk - 75% for Go devices.
|
||||||
# For 512MB Go device, size = 384MB, set same for Non-Go.
|
# For 512MB Go device, size = 384MB, set same for Non-Go.
|
||||||
# For 1GB Go device, size = 768MB, 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.
|
# And enable lz4 zram compression for Go targets.
|
||||||
|
|
||||||
RamSizeGB=`echo "($MemTotal / 1048576 ) + 1" | bc`
|
RamSizeGB=`echo "($MemTotal / 1048576 ) + 1" | 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`
|
zRamSizeBytes=`echo "$RamSizeGB * 1024 * 1024 * 1024 / 2" | bc`
|
||||||
zRamSizeMB=`echo "$RamSizeGB * 1024 / 2" | bc`
|
zRamSizeMB=`echo "$RamSizeGB * 1024 / 2" | bc`
|
||||||
|
fi
|
||||||
|
|
||||||
# use MB avoid 32 bit overflow
|
# use MB avoid 32 bit overflow
|
||||||
if [ $zRamSizeMB -gt 4096 ]; then
|
if [ $zRamSizeMB -gt 4096 ]; then
|
||||||
zRamSizeBytes=4294967296
|
zRamSizeBytes=4294967296
|
||||||
|
@ -565,13 +572,7 @@ function configure_zram_parameters() {
|
||||||
if [ -f /sys/block/zram0/use_dedup ]; then
|
if [ -f /sys/block/zram0/use_dedup ]; then
|
||||||
echo 1 > /sys/block/zram0/use_dedup
|
echo 1 > /sys/block/zram0/use_dedup
|
||||||
fi
|
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
|
echo $zRamSizeBytes > /sys/block/zram0/disksize
|
||||||
fi
|
|
||||||
|
|
||||||
# ZRAM may use more memory than it saves if SLAB_STORE_USER
|
# ZRAM may use more memory than it saves if SLAB_STORE_USER
|
||||||
# debug option is enabled.
|
# debug option is enabled.
|
||||||
|
@ -671,11 +672,9 @@ if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] || [ "$Produc
|
||||||
echo 100 > /proc/sys/vm/swappiness
|
echo 100 > /proc/sys/vm/swappiness
|
||||||
else
|
else
|
||||||
arch_type=`uname -m`
|
arch_type=`uname -m`
|
||||||
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
|
|
||||||
MemTotal=${MemTotalStr:16:8}
|
|
||||||
|
|
||||||
# Set parameters for 32-bit Go targets.
|
# 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
|
# Disable KLMK, ALMK, PPR & Core Control for Go devices
|
||||||
echo 0 > /sys/module/lowmemorykiller/parameters/enable_lmk
|
echo 0 > /sys/module/lowmemorykiller/parameters/enable_lmk
|
||||||
echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
|
echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
|
||||||
|
|
Loading…
Reference in a new issue