From owner-freebsd-questions@FreeBSD.ORG Fri Feb 13 15:38:11 2004 Return-Path: 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 EC67E16A4D0 for ; Fri, 13 Feb 2004 15:38:11 -0800 (PST) Received: from geminix.org (gen129.n001.c02.escapebox.net [213.73.91.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77F8043D1D for ; Fri, 13 Feb 2004 15:38:11 -0800 (PST) (envelope-from gemini@geminix.org) Message-ID: <402D5FDF.9020104@geminix.org> Date: Sat, 14 Feb 2004 00:38:07 +0100 From: Uwe Doering Organization: Private UNIX Site User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040119 X-Accept-Language: en-us, en MIME-Version: 1.0 To: questions@freebsd.org References: <00bc01c3f278$5f6dbb10$6401a8c0@yourqqh4336axf> <20040213215702.GA71830@falcon.midgard.homeip.net> In-Reply-To: <20040213215702.GA71830@falcon.midgard.homeip.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Received: from gemini by geminix.org with asmtp (TLSv1:AES256-SHA:256) (Exim 3.36 #1) id 1Armsr-000Com-00; Sat, 14 Feb 2004 00:38:10 +0100 Subject: Re: Determining free memory on FreeBSD 4.8-REL X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2004 23:38:12 -0000 Erik Trulsson wrote: > On Fri, Feb 13, 2004 at 03:28:34PM -0600, dap wrote: >>How do I determine if my FreeBSD is actually low on memory not? And what is >>Inact? I did read the manpages, but even they seem to skirt how I should >>view Inact vs. Free. (I did read the tuning manpage.) >> >>Let's say I have this: >>[...] >> >>So I have 82MB of free memory, 35MB of memory being used by the OS as disk >>IO, cache is different from Buf in some way or another (the top manpage >>doesn't quite go into details here). I don't quite get Inact and Wired. > > You can view all of Inactive, Cache and Free as free memory. The > difference is if the memory might be "dirty" and need to be flushed to > swap before being reused. (Free is completely free and ready to be used > at once, Cache is probably not dirty, while Inactive is probably > dirty.) Let me rephrase this a little. Pages in Inactive _can_ be dirty (if they have been written to) while pages in Cache are already clean (laundered), that is, can be used for other purposes without delay, but can also be reactivated (moved to Active) if their current contents is needed again. Inactive, on the other hand, has to be laundered before the pages move on to Cache, which they eventually do. It works like this: If the kernel's laundry routine finds a dirty page in Inactive for the first time it marks and skips it, in the hopes that the page is ephemeral and will be gone next time around. If it's not gone and the launderer finds it for the second time it schedules it for flushing to disk and skips it again. If it later finds the page for the third time it is hopefully clean by then and can be moved to Cache. Pages that are clean right from the start (that only have been read) will be moved to Cache without further ado, whenever (Cache+Free) falls below its lower hysteresis level. That is, the move will be in chunks. And yes, I agree that it's a little complicated. ;-) >>If I see ANY swapping going on should I worry? I don't think so. Some >>swapping is normal in UNIX in general. > > As you note a little bit of swapping is perfectly normal. > If you start to see a lot of swapping you probably want more memory. The slow increase in swapped-out pages you see over time even if the system is not short of memory is caused by the laundry procedure I described above, and is perfectly normal. It's kind of a preemptive strategy in order to have enough clean pages available without delay when you need them. Hope to have shed some light on the subject. Uwe -- Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers gemini@geminix.org | http://www.escapebox.net