From owner-freebsd-questions@FreeBSD.ORG Wed Sep 29 17:37:05 2010 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 3E22D1065696 for ; Wed, 29 Sep 2010 17:37:05 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id C17988FC12 for ; Wed, 29 Sep 2010 17:37:04 +0000 (UTC) Received: by wwb17 with SMTP id 17so1350160wwb.31 for ; Wed, 29 Sep 2010 10:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=wvswkXz+YhAKp8/wTXYagTTwrTlZtNDI6u1rYaflCpc=; b=IRWOu5yDv3qGyFACJtmSg2BKreVgeyBcN6d5pt+8aBz48J5oTH8lTcfwsPPx/2QaNq 5mOdx5ocSyy+O97uQdHSisnwcGWgrRIhBTQmWswLYrtGM+bq/PmLcwV1lOLgG+F8ZM7N JvGp3dHzVwbKtpOynLlJxdY9ZofDb2iioCeGE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=KtK13Z60hmDnbTzTRkybhvpDOxDy/kmLgUoQzJoJJeXTSiaKKj30EAnjRiQj4m/Sip utsXiJTFpLs4GcY0r3eab2g6l01N+Yiryk8xvzD55yXDYVSDPVv5AX+zNHJ3AyI6JmGU WKyafyYXv2HoLbguBuNxc4m1/9KO2gbmRGLSg= Received: by 10.216.44.141 with SMTP id n13mr2843272web.16.1285781823505; Wed, 29 Sep 2010 10:37:03 -0700 (PDT) Received: from gumby.homeunix.com (bb-87-81-140-128.ukonline.co.uk [87.81.140.128]) by mx.google.com with ESMTPS id p82sm5577393weq.3.2010.09.29.10.36.59 (version=SSLv3 cipher=RC4-MD5); Wed, 29 Sep 2010 10:37:01 -0700 (PDT) Date: Wed, 29 Sep 2010 18:36:57 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20100929183657.13dfea89@gumby.homeunix.com> In-Reply-To: <4CA333EC.40704@ose.nl> References: <800348.43799.qm@web113901.mail.gq1.yahoo.com> <246095.42115.qm@web113905.mail.gq1.yahoo.com> <4CA2E345.7070006@ose.nl> <20100929124230.00004796@unknown> <4CA333EC.40704@ose.nl> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd8.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: Cache Memory in top command 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: Wed, 29 Sep 2010 17:37:05 -0000 On Wed, 29 Sep 2010 14:41:16 +0200 Bas Smeelen wrote: > On 09/29/2010 01:42 PM, Bruce Cran wrote: > > On Wed, 29 Sep 2010 08:57:09 +0200 > > Bas Smeelen wrote: > > > > > >> *Cache:* number of clean pages caching data that are available for > >> immediate reallocation > >> http://www.freebsd.org/cgi/man.cgi?query=top&sektion=1 > >> > >> > > I believe the "Cache" value is almost totally unrelated to the > > amount of memory used for caching: FreeBSD has a unified buffer > > cache so any memory is available for use as cache. Unlike Linux, > > you can't look at the line in 'top' to see how much memory is being > > used for buffers and cache. > > > > You can find more information about the VM architecture at > > http://www.freebsd.org/doc/en/books/arch-handbook/vm.html . > > > > > The way I understand it: > The amount of cached file data pages is included in the Wired value > The amount of free cache pages that can immediatly can be re-used for > caching is the Cache value I don't see why it would be included in wired, and I'm pretty sure that's wrong. The cache queue is a stock of clean pages, it's sort of an intermediate state between inactive and free. Most memory allocations can be performed directly from the cache queue, which allows memory to hold useful data right up to the moment it's reallocated, and it allows FreeBSD to run with very little free (i.e. wasted) memory. Cache memory is topped-up with memory from the inactive queue in the background. Likewise inactive memory is topped-up from active memory. Since that's done on demand the values are virtually meaningless. > The Buf value is the numbder of pages used for BIO-level disk caching > I think that the value of Inactive also includes some kind of > application data cache Pretty much anything that isn't permanently wired can end-up in the Inactive queue it's a general purpose queue for ageing-out memory. > So as you also state, unlike linux there is no way of determining the > amount of memory used for *all caching* with top FreeBSD sees most memory as a cache of a disk backing-store. So when you are running a program, it's executing inside a cache of the on-disk binary and its variables are a cache of the swap backing-store.