What happens if I execute the command
sudo swapoff -a && swapon -a
having RAM full 25GB/32GB and swap full 20GB/32GB? 25+20 = 45 > 32 so there's no way RAM can fit all operating data. On the other hand, it's only for a few seconds before swap is turned on again.
The goal of it is that the performance of my laptop is better when I restart swap from time to time and I want to use crontab
to do it once a day. I don't want to worry what happens if there's not enough memory. I don't care if a swap file is created temporarily to contain the content of the swap partition. I don't want the kernel to kill any processes. Can I somehow instruct kernel that if the RAM capacity is insufficient, it should create a swap file temporarily for swapoff + swapon
?
man
, thx let's make it an answer