Simple swap question

Daniel Bye danielby at slightlystrange.org
Thu Dec 18 17:11:49 UTC 2008


On Thu, Dec 18, 2008 at 12:02:06PM -0500, FreeBSD wrote:
> Daniel Bye a ?crit :
> >On Thu, Dec 18, 2008 at 10:28:18AM -0600, Kirk Strauser wrote:
> >>On Thursday 18 December 2008 09:16:10 FreeBSD wrote:
> >>>Hi everyone,
> >>>
> >>>I have a FreeBSD 7.0-Release server that started to swap after an error
> >>>in a shell script (process spawning competition ;-) ). I killed the
> >>>shell and the RAM is now OK. The problem is that the swap is still used.
> >>>How can I "reset" the swap?
> >>You don't.  The system will handle it for you, I promise.  :-)
> >
> >And very well, too.
> >
> >You can prompt it to move pages back into RAM if you start using a swapped-
> >out process again - say, for example, a quiescent word processor had been
> >swapped out, you could get it back by raising it and starting to type.
> >
> >But as Kirk said, there really is no need. It's one of the kernel's many
> >jobs, and I'm inclined to leave it get on with it!
> >
> >Dan
> >
> 
> Thanks for your answer. I'm asking here because it's been several days 
> and there is still used swap for data that should never be used anymore. 
> If the kernel wants to keep it, why not move it to RAM now that there is 
> some free?

Because it has swapped out an entire process, which hasn't subsequently
been woken up again. It's you that says the data are never going to be
needed again - the kernel doesn't know that, so keeps the pages there in
swap until you either reawaken the process, or kill it, at which point
the swap space they occupied will be freed up.

You can see which processes are swapped out in top - the process name is
in parentheses. If it is irking you sufficiently, you can kill the
processes and reclaim your swap ;-)

Dan

-- 
Daniel Bye
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20081218/53b6f11f/attachment-0001.pgp


More information about the freebsd-questions mailing list