[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Clear Swap Cache



Once upon a time, Alan Stanley <alanst@xxxxxxxxxxxxxxxx> said:
> Is it possible to manually clear the swap cache without having to resort to
> a reboot? Even long after the swap was needed, the cached swap remains when
> it is no longer needed. I would like to clear it every one and a while
> without having to reboot. Any ideas? I'm using a Raq3i.

If you are talking about swap space being used, like this:

             total       used       free     shared    buffers     cached
Mem:        128180     112832      15348      58644      50332      30960
-/+ buffers/cache:      31540      96640
Swap:       131536       8888     122648

where there is 8888 kB of swap used, then don't worry about it.  At some
point, there was enough of a demand for RAM that some little used pages
of RAM were swapped out.  If they are needed, they will automatically be
swapped back in.  However, there are several long-running system daemons
that tend to have a few pages of RAM that are used at start time (or
some other rare event) that are not freeded but are not needed either.
Those will get pushed to swap and then, since they are not needed, they
will not be swapped back in regularly.  If you pulled them back into
RAM, then the next time something needed a big chunk of RAM the system
would first have to swap those pages back out again.

Really, folks, let Linux manage the memory.  It is quite good at that.
Leaving those unneeded pages of RAM swapped out just means there is more
free RAM for buffers and cache (both are types of disk caching, they are
just at different levels) and for programs.
-- 
Chris Adams <cmadams@xxxxxxxxxx>
Systems and Network Administrator - HiWAAY Information Services
I don't speak for anybody but myself - that's enough trouble.