Swap Usage even with Abundant RAM

Is it normal for my Linode to be swapping out to the swap file occasionally even when it has 200+MB of RAM free? Slowly over time, it seems to be using more and more of the swap and according to free, that swap is never reclaimed.

Here is a sample output from free -m:

             total       used       free     shared    buffers     cached                           
Mem:           360        311         48          0         10        181                           
-/+ buffers/cache:        119        241                                                            
Swap:          255         72        183                                                            

That 72 used swap never seems to get reclaimed. And I have not been able to find any evidence that I was ever in any danger of running out of memory.

I'm running Ubuntu 8.10 64bit. Is this normal?

.

5 Replies

Not an expert on this, but I think that once something does get swapped out it is normal for it to stay swapped out until it is actually needed again.

I think the swappiness parameter tells the kernel how aggressively to swap - you can check what yours is set to by````
$ cat /proc/sys/vm/swappiness

````
The value 60 is the default, and I think higher means more agressive swapping.

Unless your RAM is (nearly) full, there's little need to be worried about swap use. Linux is clever. It usually knows best what should be placed in RAM, what should be placed in swap, and what should be loaded from disk on request. In fact, that 70M of swap could improve performance by freeing up more RAM for buffers and cache.

@Lykaon:

That 72 used swap never seems to get reclaimed. And I have not been able to find any evidence that I was ever in any danger of running out of memory.

my linode (360) shows exactly the same behaviour, nothing seems to be wrong with it.

i looked at my munin logs and i always have a few megs of swap allocated (even though i have >150MB of free memory) but the swap in/out graph barely shows any activity so i don't think there is a performance problem.

Thanks everyone. Sounds like I can stop worrying about it then. :P

I made the same question …

http://www.linode.com/forums/viewtopic. … highlight=">http://www.linode.com/forums/viewtopic.php?t=3925&highlight=

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct