Option One: they only apply in the case of swap partition memory exhaustion
# 首先进入 sudo 模式
sysctl vm.swappiness=0 # 临时生效
echo "vm.swappiness = 0" >> /etc/sysctl.conf # 永久生效
Option Two: to completely disable swap partition
If your memory is absolutely enough, you can completely disable the swap swap partition to avoid possible impact.
sudo swapoff -a
: The temporary closure of the swap partition- Modify
/etc/fstab
, comment out the line with a swap words (Comments start with #). sudo rm -rf /swap
: Completely deleted the swap partition