Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2012 07:46:30 -0700
From:      Steve Rikli <sr@genyosha.net>
To:        freebsd-hackers@freebsd.org
Subject:   Re: distinguish between Maxmem, realmem, physmem
Message-ID:  <20120628144630.GA50099@dragon.genyosha.net>
In-Reply-To: <201206280958.13859.jhb@freebsd.org>
References:  <CBE35EDBE4727C4BAD013A73D993FE6B04B28AE5C655@EMBX01-WF.jnpr.net> <201206280958.13859.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120628144630.GA50099>