Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2010 18:36:57 +0100
From:      RW <rwmaillists@googlemail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Cache Memory in top command
Message-ID:  <20100929183657.13dfea89@gumby.homeunix.com>
In-Reply-To: <4CA333EC.40704@ose.nl>
References:  <800348.43799.qm@web113901.mail.gq1.yahoo.com> <AANLkTinxG2k082x=PQoHAq1d8h_Wn0vUwiXO1cssy4Er@mail.gmail.com> <246095.42115.qm@web113905.mail.gq1.yahoo.com> <4CA2E345.7070006@ose.nl> <20100929124230.00004796@unknown> <4CA333EC.40704@ose.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 Sep 2010 14:41:16 +0200
Bas Smeelen <b.smeelen@ose.nl> wrote:

> On 09/29/2010 01:42 PM, Bruce Cran wrote:
> > On Wed, 29 Sep 2010 08:57:09 +0200
> > Bas Smeelen <b.smeelen@ose.nl> 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
> >> <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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100929183657.13dfea89>