Yes and no …
The swap partition is an extended memory. Newest kernels are reserving the entire ram at start so when an application needs more ram, swap partition is here for us. But what if our swap partition is full ? That cannot be done cause there is a percent that kernel is using for the swap partition. This kernel value is described here:
cat /proc/sys/vm/swappiness
In most linux systems the default value is 60 percent.
In virtual machines we should reduce this percent to something small cause of IO limitations.
In our desktops we can increase it, to even higher values.
But what if we need more ram, more swap ?
What if our applications are running all together and the swap partition is in its limits ?
Then just … swapoff !!!
With swapoff the system will drop the swap partition!
But how this is more helpful ?
It isnt !
swapoff frees up unused memory and we can change the value of swappiness to something higher, lets say:
sudo sysctl -w vm.swappiness=80
And then swapon the swap partition again …
If we need to make a permanent change for the swappiness, we need to make it to /etc/sysctl.conf