Operating System - Linux
1752805 Members
5620 Online
108789 Solutions
New Discussion юеВ

Re: Why my system swap although the system has enough free memory

 
mohamed.bouraoui
Frequent Advisor

Why my system swap although the system has enough free memory

Dear Men
I have a question that I couldnтАЩt find the good aswer at this question,
My linux system is Red Hat Enterprise Linux ES release 3 (Taroon Update 9), memory seize: 6Go
The free command returns this output:
total used free shared buffers cached
Mem: 6097300 5887720 209580 0 7992 3663696
-/+ buffers/cache: 2216032 3881268
Swap: 1052248 356900 695348
it means that the exactly free memory is (free + buffers + cached)=3663696+7992+209580=3881268Ko
my question is, why the system use swap (356900Ko) although the system has enough free memory?
Thanks at advance
Best regards.
3 REPLIES 3
Ivan Ferreira
Honored Contributor

Re: Why my system swap although the system has enough free memory

I think that a good explanation is here:

http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space

A program may request more memory that it really need, or use a significant number of pages during its startup phase and then never used again.

The system can swap out those pages and free the memory for other applications or even for the disk cache.

"So, as an administrator of these other UNIX system, dealing with memory management goes like this: you expect to see swap in "use"...it means that allocations have been made against it. But it but does not mean any disk IO has happened!.

What you have to do for monitoring is watch the actual swapping stats via sar or some other utility."
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
macosta
Trusted Contributor

Re: Why my system swap although the system has enough free memory

Additionally, the kernel may have a parameter set, depending on distribution, to utilize swap even when not necessary - it's not necessarily a bad thing, being that additional space is made available to available memory and cache, but is likely not a huge issue unless you're thrashing your disk on swap. If you're under memory pressure, then worry about it; it will then become much more complicated a problem.
Gerardo Arceri
Trusted Contributor

Re: Why my system swap although the system has enough free memory

I will refer you to
http://linuxatemyram.com

The parameter that sets the "swappability" or "swappiness"of the running kernel is documented on
https://help.ubuntu.com/community/SwapFaq#What%20is%20swappiness%20and%20how%20do%20I%20change%20it?

Regards, Gerardo