Re: setting memory size with hw.physmem

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 23 Jul 2008 10:50:56 -0400
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
Received on Wed Jul 23 2008 - 16:46:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:33 UTC