Why the server shows less total memory compared to the physical memory installed
Environment
- Red Hat Enterprise Linux
Issue
The server shows less total memory in free or top compared to the physical memory installed in the server as DIMM modules. For example, the server with 12Gb RAM (3 x 4Gb DIMM modules) shows just 11.5 Gb total memory in the free output:
$ free -b
total used free shared buffers cached
Mem: 12314402816 1381797888 10932604928 0 54702080 566779904
-/+ buffers/cache: 760315904 11554086912
Swap: 17179865088 0 17179865088
$ bc -lq
12314402816/1024^3
11.46868133544921875000
Resolution
-
There is nothing can be done on this. To have some missing memory in the output of
freeortopis normal. It is not a bug, it is a feature. -
The system needs some memory space to handle all other memory addressing (for so-called page tables), for the kernel itself and for the internal kernel structures.
-
In order to obtain the total RAM installed in the system, one can run the next command:
# dmidecode -t memory | grep "Memory Device" -A5 | grep Size | awk '$3 ~ /GB/ {sum += $2} $3 ~ /MB/ {sum += $2/1024} END {printf "%s GB\n", sum}'
Root Cause
-
The kernel reserves some amount of memory (proportional to its total size) at the startup for memory tables (for virtual-to-physical addresses translation). This memory given to the memory tables cannot be used by anything else and is subtracted from the total memory size reported.
-
The bigger physical RAM size is, the smaller is the ratio of the memory which cannot be used to the total physical RAM size:
- On 12GB desktop this ratio is around 4.5%
- On 32GB server this ratio is around 2.5%
- On 512GB server this ratio is around 1.56%
-
You can read about this in more details in the Content from linux-mm.org is not included.Where Did My Memory Go article on Content from linux-mm.org is not included.Content from linux-mm.org is not included.http://linux-mm.org/ site.
Please, note, this article is a 3rd-party resource, Red Hat does not control and is not responsible for the information published there.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.