When would Linux choose to swap out instead of using the free memory or buff/cache space?

Here is my data on my computer:

$ free
            total      used      free    shared  buff/cache  available
Mem:    528011992  51967272  43464000   1285108   432580720  472048004
Swap:    30769148       780  30768368

As we can see, I still have 43Gb of free RAM and 432Gb of buff/cache used. Why would Linux decide to use 780Kb of swap in that situation?

I thought I understood memory management in Linux, but I'm at a loss in this situation.

Maybe useful info: I am running several VPS and I'm pretty sure that their memory isn't committed by default (I'm pretty sure because I have one which I set with 32Gb of RAM and on a reboot I don't see that memory used up). Could the reserved 43Gb be in link with that?

Another note: my computer has two CPUs and the RAM uses NUMA, which is something new to me. Although I could imagine that having an impact, 43Gb of free RAM... and the kernel decides to swap...

Also, I read these answers why is some of my swap space being used, when I still have unused RAM? but it did not really help much. I'm pretty sure I understand the basics.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.