Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Sep 2006 14:44:50 -0500
From:      Dan Nelson <>
To:        Pietro Cerutti <>
Cc:        FreeBSD Questions <>
Subject:   Re: swap
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
In the last episode (Sep 24), Pietro Cerutti said:
> 512 MB of Ram, 1024 MB of swap, 6.1-STABLE
> After some time my system begins swapping, which is normal.
> The weird thing is that swapping goes on even after closing the memory
> consuming programs.
> here's the output of top(1):
> Mem: 103M Active, 37M Inact, 107M Wired, 6656K Cache, 60M Buf, 240M Free
> Swap: 1024M Total, 106M Used, 918M Free, 10% Inuse

I se no swapping here (that would show up as "###K In, ###K Out" on the
swap line).  You have swap space in use but not actively used.
> Why the swapped pages don't get recalled back to main mamory (which
> has sufficient free space for them), freeing the swap device and thus
> speeding the system up?

Once the kernel decides to swap a page, that area of swap is reserved
until the process exits, even if the kernel pulls the data back from
swap.  That way if memory gets low again, the kernel knows it can
quickly discard the in-RAM copy of the data (since there's already a
copy in swap).

Processes likely to have pages swapped out are getty&login proceses for
unused ttys, lpd, sshd and other long-running daemons, etc.  There's no
reason to pull those pages back into RAM because you're more likely to
need that RAM for something else.

	Dan Nelson

Want to link to this message? Use this URL: <>