From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 28 15:08:43 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EFCCE1065674 for ; Thu, 28 Jun 2012 15:08:43 +0000 (UTC) (envelope-from sr@genyosha.net) Received: from ns1.genyosha.net (ns1.genyosha.net [108.86.149.91]) by mx1.freebsd.org (Postfix) with ESMTP id 640698FC12 for ; Thu, 28 Jun 2012 15:08:43 +0000 (UTC) Received: from dragon.genyosha.net (dragon.genyosha.net [108.86.149.92]) by ns1.genyosha.net (8.14.5/8.14.4) with ESMTP id q5SEkVU4041753 for ; Thu, 28 Jun 2012 07:46:31 -0700 (PDT) (envelope-from sr@genyosha.net) Received: from dragon.genyosha.net (localhost [127.0.0.1]) by dragon.genyosha.net (8.14.5/8.14.5) with ESMTP id q5SEkUZ2050402 for ; Thu, 28 Jun 2012 07:46:30 -0700 (PDT) (envelope-from sr@dragon.genyosha.net) Received: (from sr@localhost) by dragon.genyosha.net (8.14.5/8.14.5/Submit) id q5SEkUNH050401 for freebsd-hackers@freebsd.org; Thu, 28 Jun 2012 07:46:30 -0700 (PDT) (envelope-from sr) Date: Thu, 28 Jun 2012 07:46:30 -0700 From: Steve Rikli To: freebsd-hackers@freebsd.org Message-ID: <20120628144630.GA50099@dragon.genyosha.net> References: <201206280958.13859.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206280958.13859.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (ns1.genyosha.net [108.86.149.91]); Thu, 28 Jun 2012 07:46:31 -0700 (PDT) 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:08:44 -0000 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: > > > > 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? > > > > Accordign to source code: > > Maxmem ==> the highest page of phisycal address page : if I understand > > correctly, this is the highest page number of physical memory that is > > usable? > > > > realMem --> somehow get assigned by realmem = Maxmem: this is confuing, if > > they are the same, why bother a realmem variables > > I think realMem is legacy. > > > 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) > > Correct. Note that the firmware can also take up part of RAM as well (e.g. > to hold ACPI tables). 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: real memory = 1073741824 (1024 MB) avail memory = 1023852544 (976 MB) but the presumably equivalent sysctl values are different: hw.realmem: 1065287680 hw.physmem: 1047953408 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. Is dmesg the (only?) place to get that number? Cheers, sr.