slackware-current/source/a/sysvinit-scripts/default/zram.i686

35 lines
1.1 KiB
Text
Raw Normal View History

# Should we use swap on ZRAM?
ZRAM_ENABLE=1
# Total system RAM, in KB:
MEMTOTAL=$(echo $(cat /proc/meminfo | grep ^MemTotal:) | cut -f 2 -d ' ')
# ZRAM device size. We'll make this the same size as the system RAM.
# Assuming 1:4 compression, this would (if filled) occupy 1/4 of the system
# RAM. Until pages are swapped to ZRAM, the device occupies almost no RAM.
# As far as what's optimal here, I've heard all kinds of theories. So maybe
# you want to set this to twice the system RAM. Or half. Or something else
# entirely.
ZRAMSIZE=$MEMTOTAL
# In case of a 32-bit kernel, we are limited to 4G maximum ZRAM device size.
# If ZRAMSIZE size is greater than 4G, then use 4G for the ZRAMSIZE.
if [ "$(uname -m)" = "i686" ]; then
if [ "$ZRAMSIZE" -gt "4194304" ]; then
ZRAMSIZE=4194304
fi
fi
# Number of ZRAM devices. We are only going to use one of them, so there's no
# need to increase this unless you'll be needing additional ZRAM devices for
# other purposes.
ZRAMNUMBER=1
# Set the compression algorithm.
# Use zstd for best results.
# Nothing else makes any sense.
ZRAMCOMPRESSION=zstd
# Set the swap priority for the ZRAM device:
ZRAMPRIORITY=100