Comment on Help with understanding memory usage discrepancy
eager_eagle@lemmy.world 1 day agoif my system touches SWAP at all, it’s run out of memory
That’s a swap myth. Swap is not an emergency memory, it’s about creating a memory reclamation space on disk for anonymous pages (pages that are not file-backed) so that the OS can more efficiently use the main memory.
The swapping algorithm does take into account the higher cost of putting pages in swap. Touching swap may just mean that a lot of system files are being cached, but that’s reclaimable space and it doesn’t mean the system is running out of memory.
a_fancy_kiwi@lemmy.world 1 day ago
From what I can tell, my system isn’t currently using swap at all but it does have 8GB of available swap if needed.
To make sure I’m following what you are saying, if I upgraded my system to 64GB and changed nothing else, and let’s assume ZFS didn’t trying caching more stuff, would there still be a potential for my system to use swap just because the system wanted to even if it wasn’t memory constrained?
eager_eagle@lemmy.world 1 day ago
yes, the system will likely use some swap if available even when there’s plenty of free RAM left:
Src: www.kernel.org/doc/gorman/…/understand014.html
In my recently booted system with 32GB and half of that free (not even “available”), I can already see 10s of MB of swap used.
As rule of thumb, it’s only a concern or indication that the system is/was starved of memory if a significant share of swap is in use. But even then, it might just be some cached pages hanging around because the kernel decided to keep instead of evicting them.
a_fancy_kiwi@lemmy.world 20 hours ago
TIL. Thanks for the information