Ive had this weird thing going on for a few months now. The machine has 2*512M RAM (tho only 883 detected, highmem off). Ive also got a gigantic swap partition together amounting to 1788 megabytes.
The chain of events goes like this: When the machine is reebooted, all is fine for a few days. Then, swap usage starts to go up and up and up. atm after 35 days of uptime, swap usage is at 50%, so is RAM. Heres a quote of free -m:
total used free shared buffers cached
Mem: 883 866 16 0 37 356
-/+ buffers/cache: 473 410
Swap: 1788 883 904
The actual memory usage seems fine to me, allthough its a tad higher than id expect with this level of usage. (apache, mysqld, sshd, proftpd + light desktop usage including fluxbox, xmms, firefox and thunderbird) Also ive had to restart firefox and xmms every few weeks due to them eventually eating up ~300M of RAM on their own. Restarting has freed the extra RAM in use, but never affected swap usage that much.
Now, what ive understood of memory management is that the kernel cahces files to the RAM for faster reads, but it shouldnt do this to the swap, right? So, if my memory has cached RAM to spare, what is being swapped constantly? Is there some fancy way to track what is using the swap space, a top parameter for instance?
This isnt a problem that would cause me any trouble, but im quite intriqued as to what is going on. _I've always thought swap would go unused as long as there was RAM available, right?
Linux 2.4.31 (bare.i clone with minor additions)