Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is the memory which is transferred to swap due to swappiness still cached in the physical memory (until it is invalidated there)?

share|improve this question
This question is partly related to… – Ztyx Jul 2 '10 at 11:57
up vote 4 down vote accepted

Yes, the kernel will know the pages are available in both places so it can reallocate the RAM if it needs to (knowing the pages are already copied to disk). If the pages are read back into RAM later they remain on disk too (unless swap space is congested and it need to be used to page out something else).

The amount of data in pages available in both RAM and in swap at any given time can be found in /proc/meminfo under the SwapCached heading.

The kernel is unlikely to write something to swap unless it is about to immediately reallocate the RAM they occupy though. A high swappiness values doesn't mean it will swap things out needlessly - it just means it will be more likely to swap pages out to make room for buffers/cache/similar when needed instead of clearing older blocks from cache.

share|improve this answer
+1, One minor edit, most modern kernels will also swap when memory has been idle for a long time, even if it doesn't need the space. – Chris S Jul 2 '10 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.