From owner-freebsd-questions@FreeBSD.ORG Sun Sep 24 19:44:51 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8008516A40F for ; Sun, 24 Sep 2006 19:44:51 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E13F43D46 for ; Sun, 24 Sep 2006 19:44:51 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.6) id k8OJioPW063333; Sun, 24 Sep 2006 14:44:50 -0500 (CDT) (envelope-from dan) Date: Sun, 24 Sep 2006 14:44:50 -0500 From: Dan Nelson To: Pietro Cerutti Message-ID: <20060924194450.GD73717@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 6.1-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) Cc: FreeBSD Questions Subject: Re: swap X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Sep 2006 19:44:51 -0000 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 dnelson@allantgroup.com