Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Looking at how the VFS cache on my Linux machine behaves, I can see that even when effectively idle (crond and most other daemons stopped, interfaces down) the amount of free memory gradually increases implying that items are being evicted from the cache.

I did a lot of googling but can't find any reference to how this is controlled (unless it's a side effect of vm_swappiness). Can anyone put me on the right path to understanding why items are being evicted from the cache when there is no demand for new memory allocation?

share|improve this question
«implying that items are being evicted from the cache» — well, in that case vmstat would show caches size increasing, — are they really? –  poige Apr 6 '13 at 9:55
decreasing surely. Yes they are (decreasing) –  symcbean Apr 7 '13 at 0:14
So, you say free mem increasing and cache/buf size is decreasing at the same time, is it right? –  poige Apr 7 '13 at 9:53

1 Answer 1

swappiness only affects whether allocated application memory is swapped out to make room for the cache. vfs_cache_pressure is the sysctl that controls what you're seeing.

share|improve this answer
No - vfs_cache_pressure controls the ratio of meta data vs pagecache retention (at least according to the docs I've read and the experiments I've run) –  symcbean Apr 2 '13 at 9:36
Fair enough. I did a little more research and from what I can see everything is ordered into an LRU order list and only looked at when some threshold (artificial or physical) is met or surpassed. Given that, I'd assume something is still happening (like a kernel thread waking up or something). If it's super important to you to figure this out it looks like there's a pre-written systemtap script called "mmreclaim.stp" that track the memory manager's reclaimations. I would also made sure it's not actually going to swap using "sar -A." –  Joel Davis Apr 2 '13 at 15:35

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.