Skip to content

Commit

Permalink
opendingux: Use LZO for swap, not LZ4HC
Browse files Browse the repository at this point in the history
LZ4HC is much slower to compress than LZO, which makes it unpractical
for zram swap. LZ4 is a bit faster for both compression and decompression,
but uses a lot of RAM (~10 MiB) to do so.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Mar 31, 2020
1 parent edad4be commit 5d90b6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion board/opendingux/target_skeleton/etc/init.d/S09swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ SWAPPINESS=20
# User overrides.
[ -r /usr/local/etc/swap.conf ] && . /usr/local/etc/swap.conf

[ $SWAP_PERCENT_MEM -gt 0 ] || exit 0

SWAP_FILE_MB=$(expr $(sed -n 's/MemTotal: \+\([[:digit:]]\+\).*/\1/p' /proc/meminfo) \* ${SWAP_PERCENT_MEM} / 102400)
SWAP_FILE=$(zramctl -a lz4hc -s ${SWAP_FILE_MB}M -f)
SWAP_FILE=$(zramctl -a lzo -s ${SWAP_FILE_MB}M -f)

echo $SWAPPINESS > /proc/sys/vm/swappiness

Expand Down

0 comments on commit 5d90b6f

Please sign in to comment.