* run at system boot:
# enable MGLRU
echo 7 > /sys/kernel/mm/lru_gen/enabled
echo 1000 > /sys/kernel/mm/lru_gen/min_ttl_ms
# set up zswap
echo 1 > /sys/module/zswap/parameters/enabled
echo zsmalloc > /sys/module/zswap/parameters/zpool
echo lz4 > /sys/module/zswap/parameters/compressor
echo 90 > /sys/module/zswap/parameters/accept_threshold_percent
echo 13 > /sys/module/zswap/parameters/max_pool_percent
echo 1 > /sys/module/zswap/parameters/shrinker_enabled
# adjust kernel virtual memory settings:
/usr/sbin/sysctl -q vm.swappiness=180
/usr/sbin/sysctl -q vm.page-cluster=0
/usr/sbin/sysctl -q vm.watermark_boost_factor=0
/usr/sbin/sysctl -q vm.watermark_scale_factor=125* adjust kernel command line to enable pressure stall information: add
psi=1* install and enable systemd-oomd, use the attached configuration files
with this config, when my laptop runs out of memory, there is zero lag, not even audio skipping. the worst offender (not necessarily the process group with the largest allocation) is killed immediately before memory is exhausted.