Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jul 2008 10:50:56 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Manjunath Ranganathaiah <mgowda82@gmail.com>
Subject:   Re: setting memory size with hw.physmem
Message-ID:  <200807231050.56507.jhb@freebsd.org>
In-Reply-To: <d0b92eea0807221535k3fb07a60k2b76ce98b2d43a84@mail.gmail.com>
References:  <d0b92eea0807221535k3fb07a60k2b76ce98b2d43a84@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 22 July 2008 06:35:10 pm Manjunath Ranganathaiah wrote:
> On of my system with 8G of RAM running 7.0R amd64, dmesg shows memory usage 
as:
> 
> usable memory = 8576397312 (8179 MB)
> avail memory  = 8289071104 (7905 MB)
> 
> If I set hw.physmem tunable to  8g, dmesg shows the following
> 
> usable memory = 7771095040 (7411 MB)
> avail memory  = 7507386368 (7159 MB)
> 
> If I set  hw.physmem to 8950M
> 
> usable memory = 8565911552 (8169 MB)
> avail memory  = 8278892544 (7895 MB)
> 
> if I set hw.physmem to 8999M
> 
> usable memory = 8576397312 (8179 MB)
> avail memory  = 8289071104 (7905 MB)
> 
> 
> Is this expected behavior?

Yes.  hw.physmem is really setting a "max physical address".  So any physical 
memory above that address is ignored.   Generally part of the address space 
in the low 4GB range is used for memio (PCI memory BARs, VGA/CGA/EGA 
framebuffer (0xa0000)) and isn't backed by RAM.  As a result, capping 
hw.physmem=4g can actually result in a bit less than 4GB of usable/avail 
memory.

> How do I  increase or decrease physical memory size by 1MB?

Examine your SMAP (currently only available via loader 'smap' command or from 
verbose boot messages) and find the max phys addr of your RAM.  Then subtract 
1MB from that ending address and use that for your hw.physmem setting.

-- 
John Baldwin



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