Comment by BobbyTables2
3 days ago
I suspect the intent is to move stale things out of RAM so it can be immediately used for more productive purposes when needed.
Shuffling out 8GB with a spinning hard drive could take a full minute…
That said, I agree with you. I’d rather not use swap unless absolutely necessary and I don’t want the latter to happen either…
Plus, I don’t want my storage in the “critical path” of memory accesses, even if rare.
Use swap for the important things: the part of your operating system at run time which doesn't get used much, but needs to be around when needed - the contents of /lib and /usr/lib and so on, all the *.so's and the things they allocate - shared libraries among the distro install, these things can be tidily swapped, until you need it.
If you need an application to always be responsive, start it with the swappable flag turned off, i.e. something like this:
Anyway, this is a distro-originated knob which every user must tweak for their use-case.
> I suspect the intent is to move stale things out of RAM so it can be immediately used for more productive purposes when needed.
These are separate problems, though. You can clean a page by updating its backing store without purging it from memory; and purging a clean page doesn’t require a write. It’s definitely reasonable to take advantage of idle IO resources to clean dirty pages, but pages should only be purged (clean pages first, usually) when there’s an immediate need for them for something else.