Linux – Discrepancy Between Physical RAM and /proc/meminfo

linuxmemoryram

I have a system with 8 x 16 GB DIMMs, so 128 GB total.

However, the MemTotal reported by /proc/meminfo is 131927808 kB, so 131 GB

My research suggests that if anything, the meminfo should add up up to less than the RAM total.

Understanding /proc/meminfo file (Analyzing Memory utilization in Linux)

So Google's calculator reports this sum as 131 (just divided by 1000000)

https://www.google.com/search?q=131927808+kB+to+GB

If you interpret the kB to mean kibibytes it is instead: 135 GB (worse!)

If you make it Kibibytes to Gibibytes it's 125

Or Kilobytes to Gigabytes it's 122

Below are the details. Can anyone help me understand this discrepancy?

# cat /proc/meminfo
MemTotal:       131927808 kB
MemFree:         3186732 kB
MemAvailable:   99191856 kB
Buffers:         3476036 kB
Cached:         115792344 kB
SwapCached:       120540 kB
Active:         80544652 kB
Inactive:       45017236 kB
Active(anon):   28044884 kB
Inactive(anon):  3127872 kB
Active(file):   52499768 kB
Inactive(file): 41889364 kB
Unevictable:       13040 kB
Mlocked:        584115752720 kB
SwapTotal:       1953788 kB
SwapFree:              0 kB

Best Answer

Memory capacity in DIMMs is measured in powers of two, so a claimed RAM capacity of “128 giga-something” is 128 GiB which is 134,217,728 kiB. /proc/meminfo also measures memory in powers of two, so the MemTotal value of 131,927,808 can be compared with 134,217,728 and is safely less.

MemTotal is the total installed physical memory minus whatever is reserved by the system firmware and the kernel binary. Your boot log should contain a line of the form

... [    0.000000] Memory: 32784756K/33435864K available (10252K kernel code, 1243K rwdata, 3324K rodata, 1584K init, 2280K bss, 651108K reserved, 0K cma-reserved)

which will indicate exactly how much is reserved by the system (the “reserved” figure) and the kernel binary (the “kernel code” figure).

Related Question