More RAM than MemTotal

More RAM than MemTotal

Nadav Har'El nyh at math.technion.ac.il
Wed Mar 28 14:44:03 IST 2012


On Wed, Mar 28, 2012, Orna Agmon Ben-Yehuda wrote about "More RAM than MemTotal":
> So: 180Mb lost, a reward for an honest finder?

Hi Orna,

I'm not sure there is just one culprit. I am guessing that MemTotal
doesn't try to tell you how much memory you really have, but rather how
much memory can be used. I have 3 suspects on why it's lower:

1. The "struct page" overhead. Linux hold a 56 byte (or 32 byte, on
32-bit) "struct page" for each page, and the pages holding these
structures of course cannot be used for other things. This amounts to
about 1.3% of your memory being "lost" for these structures. Since
in your case 4.6% of the memory was "lost", it doesn't explain
everything.

2. The "PCI hole". PCI devices need physical memory addresses to
communicate with them (MMIO), and these addresses cannot be used as
real memory. Check if your log mentions a "BIOS-provided physical RAM
map" with a list of "reserved" (vs "usable") memory regions.

3. Perhaps (but I'm not sure) the MemTotal doesn't include the actual
code (text and initialized data) of the Linux kernel itself. This also
takes memory.

Again, these are just my suspicions. Had the kernel writers wanted, they
could have included all of the above in the MemTotal calculation. I
don't know if they did - or what they wanted MemTotal to signify.

-- 
Nadav Har'El                        |                 Wednesday, Mar 28 2012, 
nyh at math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |If at first you don't succeed, redefine
http://nadav.harel.org.il           |success.



More information about the Linux-il mailing list