Remix.run Logo
kevin_thibedeau 4 hours ago

mmap is not swap. It's using the same virtual memory mechanisms to load/dump pages to disk. The policy for when to read and write those pages is completely different.

Dylan16807 3 hours ago | parent | next [-]

When the room for memory mapped files gets low enough you get bad thrashing anyway, so the policy difference isn't that important.

Having no swap limits how much you can overburden your computer, but you also hit problems earlier. Here's some example numbers for 64GB of memory: With swap you can go up to 62GB of active program data (85GB allocated and used) before you have performance issues. Without swap you can go up to 45GB of active program data (63GB allocated and used) before you hit a brick wall of either thrashing or killing processes. The no-swap version is better at maintaining snappiness within its happy range, but it's a tradeoff.

quotemstr 3 hours ago | parent | prev [-]

It is doing exactly what swap is doing. That it's swap with a different policy doesn't make it not-swap.

Also, that separate policy shouldn't even exist. For LRU/active-list/inactive-list purposes, why does it matter whether a page is anonymous or file-backed? If you need it, you need it, and if you don't, you don't. No reason for anonymous and file-backed memory to be separate sub-sub-systems under vm.