3 ms·
Swapfiles by default in Ubuntu
- pixl97 10y agoEh, I remember years ago on the LKML that Linus gave a few reason why you should run a swap file. Those were much older kernels then we are using now, so the question is, have the reasons changed for wanting swap in the first place. First, swap wasn't about 'extra' memory in modern large memory devices, it was about being able to evict some pages from running memory that rarely need to get used, leaving more space for filesystem cache. Memory defragmentation was another reason why some swap should exist. OOM handling works differently on systems with and without swap. Myself, depending on the amount of disk space I have, I tend to only give the system 1 to 2GB of swap space. This allows a temporary overcommit to occur in smaller programs without OOM killer. If a service trys to allocate many gigabytes of memory it gets killed without ruining system performance, and it probably should be killed anyway as something has gone terribly wrong at that point.