<div dir="ltr"><font face="georgia,serif">Hi Orna, Baruch,<br></font><br><div class="gmail_quote">On Wed, Mar 28, 2012 at 2:46 PM, Baruch Siach <span dir="ltr">&lt;<a href="mailto:baruch@tkos.co.il">baruch@tkos.co.il</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Do &#39;dmesg |grep Memory:&#39; on your machine. Here is the output of mine:<br>
<br>
Memory: 3967520k/5240832k available (3402k kernel code, 1137484k absent, 135828k reserved, 3330k data, 568k init)<br>
<br>
The sum of &#39;absent&#39; and &#39;reserved&#39; should account for most of the missing RAM.<br></blockquote><div><br>It should, actually, account for all of the &quot;missing&quot; (note quotation marks!) kilobytes. The other pieces *are* available to the OS (and are used as indicated).<br>
<br>Note that these two components do not count the same thing. The &quot;reserved&quot; one is actually physical RAM that is reserved by the BIOS (typically for the various I/O stuff, including PCI, as Nadav mentioned; IIRC - not checked - the &quot;reserve&quot; boot parameter is related). The details are in &quot;dmesg | grep BIOS&quot; or similar. The &quot;absent&quot; part is *not* physical memory - these are holes in the virtual address space.<br>
<br>There are enough quirks and dark corners to confuse anyone here. The crucial observation is that neither &quot;dmesg | grep Memory&quot; nor &quot;grep MemTotal /proc/meminfo&quot; show you the physical memory (or memory allocated to a VM). They show you *available* memory. Here are some numerological details from my laptop.<br>
  <br>$ dmesg | grep Memory<br>[    0.000000] Memory: 3956448k/5242880k available (5873k kernel code, 1123116k absent, 163316k reserved, 5785k data, 960k init)<br><br>I work out that 5242880k=5G, which I know to be wrong because I only have 4G of RAM. I seem to be &quot;missing&quot; 5242880k-3956448k=1286432k, which is exactly 1123116k+163316k - see above.<br>
<br>Now, there is another little mystery: why does my computer say<br><br>$ egrep MemTotal /proc/meminfo<br>MemTotal:        3976120 kB<br><br>rather than 3956448k that is reported as available by dmesg? Recall that neither represents physical memory (that would be 4194304k). Actually, dmesg reports whatever is available at that stage in the boot process. MemTotal shows RAM available for use at the time you looked. After the boot finishes some of the memory used during boot is freed and becomes available (hint: look at the 960k reported as &quot;init&quot;), so typically you&#39;ll see a somewhat larger number in MemTotal (as is the case above). <br>
<br>I figure that 4194304k-3976120k-163316k=54868k are still reserved in one way or another. My guess is that the missing memory (about 1.3%) is struct page.<br><br>Hope that helps.<br><br></div></div>-- <br>Oleg Goldshmidt | <a href="mailto:oleg@goldshmidt.org" target="_blank">pub@goldshmidt.org</a><br>

</div>