Memory managment - linux

Hi,

I having problem with my linux machine
it have 6Gb physical memory and somehow it always almost coming to the bottom neck and than it start writing to the swap memory
you can see that there is more than 4G in cahce, is there any way to clean the cache or to limit it to 2Gb?

host1 /usr/local/host 3> free -ml
             total       used       free     shared    buffers     cached
Mem:          5954       5935         18          0        210       4308
Low:           770        753         16          0          0          0
High:         5183       5181          1          0          0          0
-/+ buffers/cache:       1416       4538
Swap:         4095       1003       3092

The free output I see looks just fine to me. I see 1456 used in cache not 4538.

Anyway - the kernel takes unused memory and uses it for cache. If there are processes on the box, it's usual to see most of the memory as "used". The kernel releases it as needed.

What bad symptoms are you seeing?

The cache is on 4308:

             total       used       free     shared    buffers     cached
Mem:          5954       5935         18          0        210       4308

the bad symtomps is that it writes to the swap, when it hold so much memory in cache,

I'd like it to realse the cache and use it b4 using the swap memory

First off, is your kernel 2.4? Knowing your Linux version and distro may help us, too.

Hi
You right I should give u that b4
its 2.4.21-32

2.4 has known issues with hanging on to cache too long - here try this:

http://www.ussg.iu.edu/hypermail/linux/kernel/0308.2/0700.html

This explains the pagecache:
http://www.faqs.org/docs/kernel\_2_4/lki-4.html

You have choices - find a patch/upgrade for your kernel, or upgrade to 2.6 which does not have the problem of "not letting go". This sounds like a RH kernel, they have an update center, did you check with them?

Ok thanks
Ill look on that