From owner-freebsd-questions@FreeBSD.ORG Sun Dec 14 08:05:06 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F33F616A4CF for ; Sun, 14 Dec 2003 08:05:05 -0800 (PST) Received: from maxlor.mine.nu (c-213-160-32-54.customer.ggaweb.ch [213.160.32.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06D8043D31 for ; Sun, 14 Dec 2003 08:05:04 -0800 (PST) (envelope-from benlutz@datacomm.ch) Received: from localhost (localhost [127.0.0.1]) by maxlor.mine.nu (Postfix) with ESMTP id 5980712CEBE for ; Sun, 14 Dec 2003 17:05:02 +0100 (CET) Received: from maxlor.mine.nu ([127.0.0.1]) by localhost (midgard [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 78994-05 for ; Sun, 14 Dec 2003 17:05:01 +0100 (CET) Received: from merlin.intranet (merlin.intranet [10.0.0.16]) by maxlor.mine.nu (Postfix) with SMTP id C087012CCBC for ; Sun, 14 Dec 2003 17:05:01 +0100 (CET) Date: Sun, 14 Dec 2003 17:04:55 +0100 From: Benjamin Lutz To: freebsd-questions@freebsd.org Message-Id: <20031214170455.723380b9.benlutz@datacomm.ch> X-Mailer: Sylpheed version 0.9.8 (GTK+ 1.2.10; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Sun__14_Dec_2003_17_04_55_+0100_qxsinayh1K6SmnKN" X-Virus-Scanned: by amavisd-new at maxlor.mine.nu Subject: memory categories X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2003 16:05:06 -0000 --Signature=_Sun__14_Dec_2003_17_04_55_+0100_qxsinayh1K6SmnKN Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit I'm trying to understand what FreeBSD uses its memory for. Unfortunately, I've not been able to find documentation that answers all my questions, so I'm hoping someone on this list can answer them. Let's start with top(1)'s memory categories: Free: Not used for any purpose. (vm.stats.vm.v_free_count) Active: Used by userland programs. (vm.stats.vm.v_active_count) Cache: Well, this obviously caches something... but what? Filesystem? (vm.stats.vm.v_cache_count) Inactive: This seems to be the biggest chunk of memory on my system. What exactly is the meaning of this? Someone explained it as "memory that a program has grabbed that isn't currently being used. It can be swapped to disk if RAM is needed by other programs.". How does the system know that this memory is not being used? Is this the difference between the RES and SIZE colums in top(1)'s output? (vm.stats.vm.v_inactive_count) Wired: I've only been able to figure out that this is memory that's being actively used and that cannot be relocated in any way. Could someone explain this in a bit more detail? What exactly is the difference between active and wired memory? (vm.stats.vm.v_wired_count) Buf: I'm puzzled... If I add up Free, Active, Cache, Inactive, Wired and Buf, I get more memory than I have physically installed. I could not find a sysctl that represents this value. Also, .v_free_count, v_active_count, v_cache_count, v_inactive_count and v_wired_count add up to vm.stats.vm.v_page_count... where does this Buf come from? And some more questions: On my system, these sysctls have these values: hw.physmem = 1064734720 = 1015.410MB hw.usermem: 947351552 = 903.465MB hw.availpages = 259945 vm.stats.vm.v_page_count: 255299 vm.stats.vm.v_page_size: 4096 hw.availpages * .v_page_size = 1064734720 = 1015.410MB .v_page_count * .v_page_size = 1045704704 = 997.262MB I have 1024MB of RAM installed. Why is hw.physmem inaccurate? And why is .v_page_count * .v_page_size less than hw.physmem? Is the difference between hw.physmem and hw.usermem used for the kernel? If yes, 112MB seems to be a huge amount? Phew... quite a few questions... Let's see what answers you can give me! Benjamin --Signature=_Sun__14_Dec_2003_17_04_55_+0100_qxsinayh1K6SmnKN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/3IosgShs4qbRdeQRAibGAJ9G7FjwK75KQNg69b/9Xdiv2wFlzgCdGFe0 NJuouASibNIQmgUuFmHae5Q= =sqO2 -----END PGP SIGNATURE----- --Signature=_Sun__14_Dec_2003_17_04_55_+0100_qxsinayh1K6SmnKN--