From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 28 15:18:52 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 793591065670 for ; Thu, 28 Jun 2012 15:18:52 +0000 (UTC) (envelope-from aboyer@averesystems.com) Received: from mail.averesystems.com (50-73-27-109-cpennsylvania.hfc.comcastbusiness.net [50.73.27.109]) by mx1.freebsd.org (Postfix) with ESMTP id 4341E8FC0A for ; Thu, 28 Jun 2012 15:18:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.averesystems.com (Postfix) with ESMTP id BACB94805A1; Thu, 28 Jun 2012 11:18:48 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail.averesystems.com Received: from mail.averesystems.com ([127.0.0.1]) by localhost (mail.averesystems.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ywd-RofrVNoV; Thu, 28 Jun 2012 11:18:48 -0400 (EDT) Received: from riven.arriad.com (206.193.225.214.nauticom.net [206.193.225.214]) by mail.averesystems.com (Postfix) with ESMTPSA id 16DA148024E; Thu, 28 Jun 2012 11:18:48 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Andrew Boyer In-Reply-To: <20120628144630.GA50099@dragon.genyosha.net> Date: Thu, 28 Jun 2012 11:18:45 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <0262B234-1618-4072-92A9-7EC1D3AE596D@averesystems.com> References: <201206280958.13859.jhb@freebsd.org> <20120628144630.GA50099@dragon.genyosha.net> To: Steve Rikli X-Mailer: Apple Mail (2.1278) Cc: freebsd-hackers@freebsd.org Subject: Re: distinguish between Maxmem, realmem, physmem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 15:18:52 -0000 On Jun 28, 2012, at 10:46 AM, Steve Rikli wrote: > On Thu, Jun 28, 2012 at 09:58:13AM -0400, John Baldwin wrote: >> On Tuesday, June 26, 2012 3:41:10 pm Ping Chen wrote: >>>=20 >>> I am a bit confused with all these variables defined in >>> freebsd(especially in freebsd 6.1): Which one of this represents the >>> real memory of a system? Say we bought a system with 4G ram, which = one >>> tells me the RAM is 4G? >>>=20 >>> Accordign to source code: >>> Maxmem =3D=3D> the highest page of phisycal address page : if I = understand >>> correctly, this is the highest page number of physical memory that = is >>> usable? >>>=20 >>> realMem --> somehow get assigned by realmem =3D Maxmem: this is = confuing, if >>> they are the same, why bother a realmem variables >>=20 >> I think realMem is legacy. >>=20 >>> physmem --> the number of usage pages : this seems the right one = extract >>> the memory info, however, it seems system allocate portion of memory = to >>> messge buffer which makes this physmem < 4G (assume RAM is 4G) >>=20 >> Correct. Note that the firmware can also take up part of RAM as well = (e.g. >> to hold ACPI tables). >=20 > Given that, are the values for real & avail memory from 'dmesg' = presented > anywhere like sysctl? E.g. one of my small servers has these from = dmesg: >=20 > real memory =3D 1073741824 (1024 MB) > avail memory =3D 1023852544 (976 MB) >=20 > but the presumably equivalent sysctl values are different: >=20 > hw.realmem: 1065287680 > hw.physmem: 1047953408 >=20 > For system hardware inventory purposes (I assume OP is asking for = reasons > along those lines, as am I) I'd want the value which reflects 1024MB = of > RAM in this case, understanding that it may not be precisely the = amount > available for system/user/etc. usage. >=20 > Is dmesg the (only?) place to get that number? >=20 > Cheers, > sr. Here I use hw.physmem and round up to the nearest 1GB. You can also check the output of 'dmidecode -t 17' and total up the = listed size of each DIMM. It gets its info from the BIOS, which probed = the SPD on each EEPROM at boot time. dmidecode is in = ports/sysutils/dmidecode. Sometimes a flaky motherboard won't find all of the memory, so it's = useful to make sure they match. -Andrew -------------------------------------------------- Andrew Boyer aboyer@averesystems.com