Comment on Help with understanding memory usage discrepancy
tal@lemmy.today 1 day agoIf oomkiller starts killing processes, then you’re running out of memory.
Well, you could want to not dig into swap.
Comment on Help with understanding memory usage discrepancy
tal@lemmy.today 1 day agoIf oomkiller starts killing processes, then you’re running out of memory.
Well, you could want to not dig into swap.
a_fancy_kiwi@lemmy.world 1 day ago
That’s pretty much where I’m at on this. As far as I’m concerned, if my system touches SWAP at all, it’s run out of memory. At this point, I’m hoping to figure out what percent of the memory in use is unimportant cache that can be closed vs important files that process need to function.
eager_eagle@lemmy.world 1 day ago
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 23 hours 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 22 hours 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.
EarMaster@lemmy.world 1 day ago
If that’s the case you should look into your swappiness settings. You can set this to zero meaning the swap will only be used if you’re actually out of memory, but as others have noted that is maybe not a healthy decision…
a_fancy_kiwi@lemmy.world 23 hours ago
I’m currently not in a situation where swap is being used so I think my system is doing fine right now. I’m not against swap, I get it’s better to have it than not but my intention was to figure out how close is my system getting to using swap. If it went from not using swap at all to using it constantly, I’d probably want to upgrade my ram, right? If nothing else just to avoid system slow downs and unneeded wear on my SSD
victorz@lemmy.world 1 day ago
It’s just that the system freezes for me when I used to run out of memory when I had only 32 GB of memory. Then I couldn’t do anything and had to hard reset the computer with its reset button. Then it would be nice to have a little bit of swap to kill some stuff before literally everything just stops working.
B0rax@feddit.org 1 day ago
Was that on Linux?
victorz@lemmy.world 1 day ago
Yeah, on multiple computers. Linux I feel will just happily hand out memory on loan like a bank rather than from what’s actually available. Then when it runs out, the next request for more memory will just freeze the system. ☠️