News for hackers. Stuff that matters.
Re:Do not buy RAM, compress by quotemstr on Thursday November 19, 2026 @03:37PM (#50566007)
Your system is still swapping all your file-backed pages (e.g. .so files) unless you're mlockall()-ing everything. If you pin non-file-backed pages in RAM by running without a swap file, the system has a harder time keeping your frequently-accessed file-backed pages in RAM and can't do as good a job as optimizing your usage patterns.

All you're doing by running without swap is pessimizing yourself.

Re:Do not buy RAM, compress by mrob on Thursday November 19, 2026 @04:25PM (#50566605)
I think this problem is avoided with swap on zram by setting swappiness high enough (>100). Theoretically, 200 would be best, although I'm reluctant to set it to an extreme value because I don't know how well tested that is. I was previously running swappiness=160. I increased it to 180 and I'll see if I notice any difference.
Re:Do not buy RAM, compress by teo_zero on Saturday November 21, 2026 @03:11AM (#50587087)
> I want instant access to my rarely used pages > [...] > setting swappiness high enough (>100)

I can't follow your reasoning. On the one hand you want the fastest access, on the other you advocate for high swappiness.

I think you should want swappiness=0, then the swap device can be whatever: it will be hardly ever used.

Re:Do not buy RAM, compress by mrob on Saturday November 21, 2026 @08:11AM (#50588875)
As I understand it, swappiness controls priority for evicting anonymous vs. file-backed pages. Both are equally effective at reducing memory pressure, and both are effectively "swapping". But if I'm using swap on zram then reading file-backed pages from files is slower than swapping from compressed ram.
Re:Do not buy RAM, compress by teo_zero on Saturday November 21, 2026 @07:25PM (#50595000)
> reading file-backed pages from files is slower than swapping from compressed ram

Which, in turn, is slower than not swapping at all. To avoid swapping unless absolutely needed, you set swappiness to 0. On the opposite side, to swap as soon as the kernel sees an opportunity, you tune swappiness to 200.

Re:Do not buy RAM, compress by mrob on Saturday November 21, 2026 @07:53PM (#50595144)
I'm going by the ArchWiki:

https://wiki.archlinux.org/title/Swap#Swappiness

"There is a common misconception that swappiness affects the memory threshold or prevents using swap space, but it only affects the preference for freeing up file pages over swap."

As I understand it, Linux does not preemptively evict idle pages, only as a response to memory pressure.