From owner-freebsd-hackers Mon Sep 30 05:41:43 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id FAA18634 for hackers-outgoing; Mon, 30 Sep 1996 05:41:43 -0700 (PDT) Received: from root.com (implode.root.com [198.145.90.17]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id FAA18590 for ; Mon, 30 Sep 1996 05:41:38 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by root.com (8.7.5/8.6.5) with SMTP id FAA02011; Mon, 30 Sep 1996 05:42:20 -0700 (PDT) Message-Id: <199609301242.FAA02011@root.com> X-Authentication-Warning: implode.root.com: Host localhost [127.0.0.1] didn't use HELO protocol To: Heo Sung-Gwan cc: freebsd-hackers@FreeBSD.ORG Subject: Re: nbuf in buffer cache In-reply-to: Your message of "Mon, 30 Sep 1996 21:04:27 +0900." From: David Greenman Reply-To: dg@root.com Date: Mon, 30 Sep 1996 05:42:19 -0700 Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >If NBUF is not defined and physical memory is less than 1024 pages(= 4Mbytes) >then nbuf becomes 30, and otherwise nbuf is 30 + min((physmem - 1024) / 12, >1024). > >Why does the number of buffers is calculated in this fashion? >30 buffers, 1024 pages, and division by 12 have special meaning? >There is no comment on source code. The calculation is to size the number of buffers as a function of total physical memory. The general goal is about 10% of physical memory, but as you can see, the calculation is a little more complex than that - with a smaller number on small memory systems (down to a low limit of 30 buffers). >In addition, if there is no user application processes how many buffers >are enough to run the system without degrading the performance of the system? >Only 30 buffers? Or better as many as possible? Buffers in the system are primarily used for temporary mappings of VM pages during filesystem I/O. They also are used to cache directory and inode blocks. However, VM pages that are attached to buffers can't be reclaimed by the pagedaemon, so they are sort of "locked" in memory. We've found the above calculation to be a fair compromise for system resources. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project