Revert "Remove ZRAM tuning to fix freezing"

This reverts commit 42b99ad127.

Signed-off-by: Tyler Nijmeh <tylernij@gmail.com>
latency
Tyler Nijmeh 4 years ago
parent 5ff9a29843
commit 29138fa25f

@ -136,6 +136,9 @@ Allow the scheduler to place tasks on their origin CPU, increasing cache localit
* nr_requests: 128 --> 64: Reduce I/O latencies slightly by reducing the maximum queue depth.
* cfq / kyber: Use a scheduler with balanced scheduling to reduce I/O latencies, which is essential for fast flash storage (eMMC & UFS).
### ZRAM
ZRAM reduces disk wear by reducing disk writes, and also increases cache locality by allowing more data to fit in RAM at once. KTweak configures ZRAM to take up at most half of the available RAM on the system, which is a good ratio of RAM to ZRAM for a mobile device.
# Other Notes
You should know that KTweak applies after init finishes + android mounts + 120 seconds in order to prevent Android's init from overwriting any values.

@ -58,6 +58,30 @@ write() {
fi
}
# Setup ZRAM to half of the available RAM (sync)
setup_zram() {
memsize=`cat /proc/meminfo | grep "MemTotal" | awk '{print $2}'`
halfmemsize=`echo "$(($memsize/2))"`
swapoff /dev/block/zram0
_write /sys/block/zram0/reset 1
_write /sys/block/zram0/disksize "${halfmemsize}KB"
avail_algs=`cat /sys/block/zram0/comp_algorithm`
for alg in lz4 zstd lzo deflate
do
if [[ "$avail_algs" == *"$alg"* ]]
then
_write "${queue}scheduler" "$alg"
break
fi
done
mkswap /dev/block/zram0
swapon /dev/block/zram0
}
usage() {
echo -n "Usage: `basename $0` [OPTIONS]
Options:
@ -174,4 +198,7 @@ do
write "${queue}nr_requests" 64
done
# ZRAM
[[ -d "/sys/block/zram0" ]] && setup_zram &> /dev/null &
exit 0

Loading…
Cancel
Save