title: Linux Virtual memory layout and physical memory
body: <p>I have a linux based embedded device. The device has 2GiB of RAM. I would like to get as much as memory possible to do a memtest in a user space application. </p>
  
  <p>1) through /proc interface I get 1.1GiB of memory only. Would like to understand where is the remaining 0.9 GiB is going. Is it taken by the kernel ?</p>
  
  <p>2) When kernel boots up, it prints the below virtual memory layout:
  &lt;5>Virtual kernel memory layout:
  &lt;5>    vector  : 0xffff0000 - 0xffff1000   (   4 kB)\</p>
  
  <p>&lt;5>    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)\</p>
  
  <p>&lt;5>    vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)\</p>
  
  <p>&lt;5>    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)\</p>
  
  <p>&lt;5>    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)\</p>
  
  <p>&lt;5>    modules : 0xbf000000 - 0xbfe00000   (  14 MB)\</p>
  
  <p>&lt;5>      .text : 0xc0008000 - 0xc063ab68   (6347 kB)\</p>
  
  <p>&lt;5>      .init : 0xc063b000 - 0xc0677dc0   ( 244 kB)\</p>
  
  <p>&lt;5>      .data : 0xc0678000 - 0xc06bfc90   ( 288 kB)\</p>
  
  <p>&lt;5>       .bss : 0xc06bfc98 - 0xc071fa68   ( 384 kB)\</p>
  
  <p>If I sum up all the listed memories in the bracket "()", it roughly equals to 0.9GiB.  In my first question I wanted to know where is that 0.9GiB is going. Can I safely assume now that it is fully taken by the kernel ?</p>
  
  <p>3) also the kernel prints the following line:
  &lt;4>Memory: 185308K/2093056K available (4774K kernel code, 287K rwdata, 1572K rodata, 243K init, 383K bss, 60452K reserved, 1847296K cma-reserved, 0K highmem)</p>
  
  <p>185308k/2093056K ==> (~180MiB/~2GiB). Could not get this. Why kernel prints that 180MiB is available out of 2GiB in that line ? It is not tallying with the 0.99GB layout above ? What is cma-reserved?</p>
  
  <p>Thanks much,
  Emerson</p>