From owner-freebsd-performance@FreeBSD.ORG Fri Apr 16 15:12:12 2004 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B7A6B16A4CE for ; Fri, 16 Apr 2004 15:12:12 -0700 (PDT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by mx1.FreeBSD.org (Postfix) with SMTP id 50C4543D55 for ; Fri, 16 Apr 2004 15:12:12 -0700 (PDT) (envelope-from decibel@decibel.org) Received: (qmail 65825 invoked by uid 1001); 16 Apr 2004 22:12:11 -0000 Date: Fri, 16 Apr 2004 17:12:11 -0500 From: "Jim C. Nasby" To: Igor Shmukler Message-ID: <20040416221211.GM87362@nasby.net> References: <20040416163845.GG87362@nasby.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 4.9-RELEASE-p3 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.6i cc: freebsd-performance@freebsd.org Subject: Re: How does disk caching work? X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Apr 2004 22:12:12 -0000 On Sat, Apr 17, 2004 at 01:56:55AM +0400, "Igor Shmukler" wrote: > > Is there a document anywhere that describes in detail how FreeBSD > > handles disk caching? I've read Matt Dillon's description of the VM > > system, but it deals mostly with programs, other than vague statements > > such as 'FreeBSD uses all available memory for disk caching'. > > Well, the statement is not vague. FreeBSD has a unified buffer cache. This means that ALL AVAILABLE > MEMORY IS A BUFFER CACHE for all device IO. > > > I think I know how caching memory mapped IO works for the most part, > > since it should be treated just like program data, but what about files > > that aren't memory mapped? What impact is there as pages move from > > active to inactive to cache to free? What role do wired and buffer pages > > play? > > If file is not memory mapped it is not in memory, is it? Where do you cache it? Maybe I am missing > somewhing? Do you maybe want to know about node caching? What if the file isn't memory mapped? You can access a file without mapping it into memory, right? > When pages are rotated from active to inactive and then to cache buckets they is still retains vnode > references. Once it is in free queue, there is no way to put it back to cache. Association is lost. > > Wired pages are to pin memory. So that we do not get situation when fault handling code is paged out. > > I am not FreeBSD guru so I never heard of BUFFER pages. Is there such a concept? I'm reffering to the 'Buf' column at the top of top. I remember reading something about that being used to cache file descriptors before the files are mapped into memory, but I'm not very clear on what is actually happening. -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"