[ltp] Kernel only see 3 of 4GB

Florian Reitmeir linux-thinkpad@linux-thinkpad.org
Tue, 5 Jun 2007 11:21:12 +0200


On Mon, 04 Jun 2007, Bernard Tremblay wrote:

>   Both are true.  2**32 = 4GB  thus you cannot address more than that.  But there is ways to make the 32 bits machine to use more than 32 bits in a virtual address... It's call AWE (Advanced Windowing Extensions).  The idea is to add a 3rd level to the calculation from virtual to real address.  You add 4 more bits  to the addressing and you then have 2**4=16 windows of 4GB each that you can address wich give your exactly 64GB.  This is a similar process that we used before in 16 bits addressing to go over the 64KB limitation.  This AWE feature is available at high price from M$ if you can afford to buy a datacenter licence.  This feature, as one would expect, is free with Linux big memory kernel.  Linux hackers please correct me if I'm making wrong assumptions about that AWE feature.
>    
>   We have some Compaq servers here at my work place with 4GB that report to have 3,6GB...  I don't know if it's because of PCI mapping but it makes some sense to me. But why would this PCI mapping not calculated as being part of the physical memory ? 
>    
>   Anybody would have a clearer explanation about how all this works and what is the BIOS role in this ? 

it really simple:
- applications today use the flat memory model, so on 32 bit platforms they can
see at most 4gb of ram.
- modern pci hardware needs memory for IO (like your graphic adapter ..) and
	memory access
- the linux kernel needs memory to communicate with the application, shared
	memory ..

-> so normally the last 1gb of memory is reserved for the kernel, and the lower
   0-3 gb are reserved for the application
-> so there is a per process limit, but the kernel is able to map the ram to
different processe, be aware there is not only ram, there is also swap which
counts as memory for the applications

if the chipset/bios has to support more than 3gb, it has to make sure there
is a "hole" of 1gb in the memory, so older 32bit pci hardware  is able to map
its io memory. this a not so often needed feature on 32 bit hardware, and
windows does it only support in the very expensive datacenter servers. so
many vendors do not support those mappings on "normal" enduser hardware.

the same problem exists on amd64 hardware, ..  but there is no 3gb limit per
process.

-- 
Florian Reitmeir