Web lists-archives.com

Re: using swap when there is free ram




Bruno Schneider wrote: 
> My system started using swap space even when there is available RAM:
> 
> $ free -m
>               total        used        free      shared  buff/cache   available
> Mem:           3882        1004        2303          63         573        2598
> Swap:           956         239         717
> 
> Can anyone help find the reason / prevent it?

This is normal and expected.

The kernel has decided that it has about 239MB of libraries or
other pages that it will not be using anytime soon, and since
you have swap available, it swapped it out.

This will improve your overall performance.

The absolute quantity of swap space used is not particularly 
important; what's important for performance is how much swapping
activity is going on.

The vmstat command will show you pages swapped in (si) and out
(so). You should expect that to be 0 or very low at any given
time.

If you give it two numbers:

vmstat 1 5

It will run 5 times, pausing 1 second in between each run.

-dsr-