From owner-freebsd-questions@FreeBSD.ORG Fri Oct 3 14:12:53 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F4C81065696 for ; Fri, 3 Oct 2008 14:12:53 +0000 (UTC) (envelope-from fbsd06+2L=adfcea19@mlists.homeunix.com) Received: from mxout-03.mxes.net (mxout-03.mxes.net [216.86.168.178]) by mx1.freebsd.org (Postfix) with ESMTP id 1198B8FC12 for ; Fri, 3 Oct 2008 14:12:52 +0000 (UTC) (envelope-from fbsd06+2L=adfcea19@mlists.homeunix.com) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id 7AD9B23E49A for ; Fri, 3 Oct 2008 10:12:51 -0400 (EDT) Date: Fri, 3 Oct 2008 15:12:48 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20081003151248.0dacc310@gumby.homeunix.com.> In-Reply-To: <20081002131435.efa1d07f.wmoran@potentialtech.com> References: <200810020958.54563.kirk@strauser.com> <200810021004.56210.kirk@strauser.com> <20081002131435.efa1d07f.wmoran@potentialtech.com> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: More RAM for buffers? 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: Fri, 03 Oct 2008 14:12:53 -0000 On Thu, 2 Oct 2008 13:14:35 -0400 Bill Moran wrote: > I've never been 100% clear on the exact differences, but it basically > has to do with where the data in RAM came from. Depending on whether > it was a VM page, or a disk page will determine what bucket it goes > into when it moves out of active. The distinction is between clean pages (Cache) and dirty pages (Inactive), a dirty page needs to be written to swap or synced to the disk, before it can be reused. It's the cache queue that gives the kernel "liquidity", once the free memory is drops below about 2%. It actively balances the cache and inactive queues to maintain this. > I'm fairly sure that inactive is memory used by program code. Inactive and cached queues are the first step to recycling memory. The queues don't differentiate between different origins. > When > the program terminates, the memory is marked as inactive, which means > the next time the program starts the code can simply be moved back to > active and the program need not be reloaded from disk. I think such pages can remain active. The level of active memory seems to be mostly a matter of "stock-control". When I shutdown Xorg/KDE, huge amounts of memory remain active for hours. When demand for memory increases, the queues get rebalanced to provide more cached/inactive memory. These figures don't really tell you much. > Buffer and cache memory are disk data held at different points within > the kernel. I've never been 100% clear on the difference, and I > believe it depends heavily on a thorough understanding of how the > kernel works. > > The other rule of thumb I've heard is that the closer memory is to the > left side of top output, the less expensive it is for the kernel to > move it to active ... inactive being the most efficient and cache > requiring the most work by the kernel ... I could be wrong, though. Partly, but it's more the other way around, the further to the right the easier it is to reuse (not counting buffer and wired, which are outside the normal VM/cache system). > I know that a lot of what I'm saying isn't authoritative, so I hope > I'm not remembering any of this wrong. I think to fully understand > how it works you'll need to read _The_Design_and_Implementation_. > Matt Dillon's vm-design article is a good place to start. http://www.freebsd.org/doc/en_US.ISO8859-1/articles/vm-design/article.html