mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-22 14:18:56 +00:00
Do silent zram switch from lzo to lzo-rle if available
Available with kernel 5.1 or above, made for ARM and being the new default. So switch silently from lzo to lzo-rle if possible to benefit from better performance: https://www.phoronix.com/scan.php?page=news_item&px=ZRAM-Linux-5.1-Better-Perform
This commit is contained in:
parent
dc1b17aeac
commit
99591837e3
1 changed files with 7 additions and 1 deletions
|
@ -52,7 +52,13 @@ activate_zram_swap() {
|
|||
|
||||
swap_algo=${SWAP_ALGORITHM:=lzo}
|
||||
for (( i=1; i<=zram_devices; i++ )); do
|
||||
[[ -f /sys/block/zram${i}/comp_algorithm ]] && echo ${swap_algo} >/sys/block/zram${i}/comp_algorithm 2>/dev/null
|
||||
if [ -f /sys/block/zram${i}/comp_algorithm ]; then
|
||||
# set compression algorithm, if defined as lzo choose lzo-rle if available
|
||||
# https://www.phoronix.com/scan.php?page=news_item&px=ZRAM-Linux-5.1-Better-Perform
|
||||
grep -q 'lzo-rle' /sys/block/zram${i}/comp_algorithm && \
|
||||
[[ "X${swap_algo}" = "Xlzo" ]] && swap_algo="lzo-rle"
|
||||
echo ${swap_algo} >/sys/block/zram${i}/comp_algorithm 2>/dev/null
|
||||
fi
|
||||
if [ "X${ZRAM_BACKING_DEV}" != "X" ]; then
|
||||
echo ${ZRAM_BACKING_DEV} >/sys/block/zram${i}/backing_dev
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue