logoalt Hacker News

kccqzytoday at 12:54 AM2 repliesview on HN

https://news.ycombinator.com/item?id=40697318

This HN comment and the linked post brought up a lot of good points. The main takeaway is that swap should primarily be considered a mechanism for equality of reclamation, not for emergency extra memory, where equality of reclamation means file-backed pages and anonymous pages are subject to similar criteria for being evicted from physical memory.

I used to have zero swap on my Linux desktop and this convinced me to add at least a small swap partition.


Replies

dlt713705today at 5:04 AM

My point is not to say that swap should not be configured on a Linux system. On bare-metal machines, I personally always set a swap partition equal in size to the amount of RAM because I usually want to be able to put the machine into S4 (suspend to disk).

I don't consider swap to be emergency RAM storage. I know that the kernel will decide by itself to use swap even if it has plenty of available RAM and the swappiness threshold is not reached.

Nevertheless, my two decent laptops (one with 16 GB RAM, the other with 64 GB RAM) never swap, even with Docker Swarm and multiple stacks, multiple VMs, desktop activities, and gaming.

It's been a while since I last saw a physical machine actively swapping.

I understand that some limited hardware may need swap, but I can't see such hardware having a GPU with plenty of VRAM.

That said, hacking things is always fun :)

show 1 reply
sidewndr46today at 2:10 AM

I just set swappiness to zero years ago and never looked back.

show 1 reply