post_boot: Set ZCache Parameters

Set ZCache parameters like max_pool_percent and clear_percent.
claer_percent is set according to Total Pages available and minfree
series for a given target.

Change-Id: Id3d7b088daeb327f3323f7cafda507a853c446fa
This commit is contained in:
Suyog Sarda 2015-12-24 15:00:22 +05:30 committed by Kishore Srivenkata Ganesh Bolisetty
parent 4ec1dd17ee
commit b67e377d74
1 changed files with 17 additions and 0 deletions

View File

@ -42,9 +42,19 @@ function configure_memory_parameters() {
# #
# Set ALMK parameters (usually above the highest minfree values) # Set ALMK parameters (usually above the highest minfree values)
# 32 bit will have 53K & 64 bit will have 81K # 32 bit will have 53K & 64 bit will have 81K
#
# Set ZCache parameters
# max_pool_percent is the percentage of memory that the compressed pool
# can occupy.
# clear_percent is the percentage of memory at which zcache starts
# evicting compressed pages. This should be slighlty above adj0 value.
# clear_percent = (adj0 * 100 / avalible memory in pages)+1
#
arch_type=`uname -m` arch_type=`uname -m`
MemTotalStr=`cat /proc/meminfo | grep MemTotal` MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8} MemTotal=${MemTotalStr:16:8}
MemTotalPg=$((MemTotal / 4))
adjZeroMinFree=18432
echo 1 > /sys/module/process_reclaim/parameters/enable_process_reclaim echo 1 > /sys/module/process_reclaim/parameters/enable_process_reclaim
echo 70 > /sys/module/process_reclaim/parameters/pressure_max echo 70 > /sys/module/process_reclaim/parameters/pressure_max
echo 30 > /sys/module/process_reclaim/parameters/swap_opt_eff echo 30 > /sys/module/process_reclaim/parameters/swap_opt_eff
@ -54,22 +64,29 @@ function configure_memory_parameters() {
echo 1024 > /sys/module/process_reclaim/parameters/per_swap_size echo 1024 > /sys/module/process_reclaim/parameters/per_swap_size
echo "18432,23040,27648,32256,55296,80640" > /sys/module/lowmemorykiller/parameters/minfree echo "18432,23040,27648,32256,55296,80640" > /sys/module/lowmemorykiller/parameters/minfree
echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
adjZeroMinFree=18432
elif [ "$arch_type" == "aarch64" ] && [ $MemTotal -gt 1048576 ]; then elif [ "$arch_type" == "aarch64" ] && [ $MemTotal -gt 1048576 ]; then
echo 10 > /sys/module/process_reclaim/parameters/pressure_min echo 10 > /sys/module/process_reclaim/parameters/pressure_min
echo 1024 > /sys/module/process_reclaim/parameters/per_swap_size echo 1024 > /sys/module/process_reclaim/parameters/per_swap_size
echo "14746,18432,22118,25805,40000,55000" > /sys/module/lowmemorykiller/parameters/minfree echo "14746,18432,22118,25805,40000,55000" > /sys/module/lowmemorykiller/parameters/minfree
echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
adjZeroMinFree=14746
elif [ "$arch_type" == "aarch64" ]; then elif [ "$arch_type" == "aarch64" ]; then
echo 50 > /sys/module/process_reclaim/parameters/pressure_min echo 50 > /sys/module/process_reclaim/parameters/pressure_min
echo 512 > /sys/module/process_reclaim/parameters/per_swap_size echo 512 > /sys/module/process_reclaim/parameters/per_swap_size
echo "14746,18432,22118,25805,40000,55000" > /sys/module/lowmemorykiller/parameters/minfree echo "14746,18432,22118,25805,40000,55000" > /sys/module/lowmemorykiller/parameters/minfree
echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
adjZeroMinFree=14746
else else
echo 50 > /sys/module/process_reclaim/parameters/pressure_min echo 50 > /sys/module/process_reclaim/parameters/pressure_min
echo 512 > /sys/module/process_reclaim/parameters/per_swap_size echo 512 > /sys/module/process_reclaim/parameters/per_swap_size
echo "15360,19200,23040,26880,34415,43737" > /sys/module/lowmemorykiller/parameters/minfree echo "15360,19200,23040,26880,34415,43737" > /sys/module/lowmemorykiller/parameters/minfree
echo 53059 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min echo 53059 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
adjZeroMinFree=15360
fi fi
clearPercent=$((((adjZeroMinFree * 100) / MemTotalPg) + 1))
echo $clearPercent > /sys/module/zcache/parameters/clear_percent
echo 30 > /sys/module/zcache/parameters/max_pool_percent
} }
case "$target" in case "$target" in