3

I'm trying to account for the available physical memory on a Linux box through /proc/meminfo (output provided below). Accounting for current free memory, user-space physical usage, kernel data structures including those vmalloc-ed, huge pages etc I'm coming up short by ~5 GB. This is what meminfo gives me at the moment:

# cat /proc/meminfo
MemTotal: 362816744 kB
MemFree: 2230348 kB
Buffers: 433636 kB
Cached: 814628 kB
SwapCached: 20688 kB
Active: 723172 kB
Inactive: 539364 kB
Active(anon): 369736 kB
Inactive(anon): 14936 kB
Active(file): 353436 kB
Inactive(file): 524428 kB
Unevictable: 2080 kB
Noswap 292435456 kB
Mlocked: 2080 kB
SwapTotal: 4190964 kB
SwapFree: 4072560 kB
Dirty: 640 kB
Writeback: 0 kB
AnonPages: 292440380 kB
Mapped: 144904 kB
Shmem: 129772 kB
Slab: 568552 kB
SReclaimable: 483816 kB
SUnreclaim: 84736 kB
KernelStack: 13776 kB
PageTables: 785532 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 156197224 kB
Committed_AS: 402420112 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 17872740 kB
VmallocChunk: 34142133244 kB
HardwareCorrupted: 0 kB
HugePages_Total: 28713
HugePages_Free: 14352
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 6144 kB
DirectMap2M: 2017280 kB
DirectMap1G: 367001600 kB

How I accounted for current memory state: MemFree + Buffers + Cached + SwapCached + AnonPages + Mapped + Slab + KernelStack + PageTables + vmalloced memory + huge pages

Since VmallocUsed throws up memory usage of external physical devices remapped (using ioremap) in addition to physical memory, to get the actual physical memory component I did the following:

echo "( $(cat /proc/vmallocinfo | grep vmalloc | awk '{print $2}' | paste -s -d "+") )/ 1024" | bc

(as suggested here).

So vmalloc physical memory consumption works out to be 826376 KB.

Huge pages = 28713 * 2048 Kb = 58804224 KB

With all this, I'm coming up with ~ 5G worth of unaccounted-for memory (comparing with MemTotal).

If there is something I have not accounted for here and could explain the gap, please do let me know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.