swapping or trashing with vast amounts of unmapped pagecache
- by Marco
I'm using kubuntu jaunty (i386 32bit), kernel 2.6.28-13-generic. I've 4Gb of RAM, of which only 3317Mb are seen by the system (I guess because of the 32bit system).
I'm seeing that the pagecache utilization is continually growing, up to the point that the system is unusable (after a few days). This happens also when I don't do anything (all user applications closed and the bare minimum of services enabled).
If enabled, the system starts to use swap space (using it all in the end).
Even if swap is disabled, disk activity becomes continuous, with the system unresponsive.
For example, right now the system is working (albeit a tad slow), with only Firefox and wing ide running, and I have 2Gb cached with only 45Mb mapped:
$ free
total used free shared buffers cached
Mem: 3346388 3247328 99060 0 8416 2117980
-/+ buffers/cache: 1120932 2225456
Swap: 2144668 519448 1625220
$ cat /proc/meminfo
MemTotal: 3346388 kB
MemFree: 97128 kB
Buffers: 7872 kB
Cached: 2120224 kB
SwapCached: 413860 kB
Active: 2304596 kB
Inactive: 865984 kB
Active(anon): 2279168 kB
Inactive(anon): 830236 kB
Active(file): 25428 kB
Inactive(file): 35748 kB
Unevictable: 32 kB
Mlocked: 32 kB
HighTotal: 2492940 kB
HighFree: 5456 kB
LowTotal: 853448 kB
LowFree: 91672 kB
SwapTotal: 2144668 kB
SwapFree: 1625244 kB
Dirty: 84 kB
Writeback: 0 kB
AnonPages: 629304 kB
Mapped: 45768 kB
Slab: 45600 kB
SReclaimable: 21756 kB
SUnreclaim: 23844 kB
PageTables: 4468 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 3817860 kB
Committed_AS: 3735020 kB
VmallocTotal: 122880 kB
VmallocUsed: 9352 kB
VmallocChunk: 66600 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 4096 kB
DirectMap4k: 16376 kB
DirectMap4M: 888832 kB
If I try to drop the caches, little happens:
# sync ; echo 3 > /proc/sys/vm/drop_caches ; free
total used free shared buffers cached
Mem: 3346388 3220580 125808 0 3020 2100600
-/+ buffers/cache: 1116960 2229428
Swap: 2144668 519356 1625312
Right now I've vm.swappiness = 5, but I've tried also with 0 and 1 (without noticeable differences).
I've also tried vm.vfs_cache_pressure = 50 and 150 (again, no differences).
As I said the pagecache eats all memory even with swapping turned off.
What is happening? How to avoid this?