Original question posted on stack overflow: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/meminfoMemTotal: 362816744 kBMemFree: 2230348 kBBuffers: 433636 kBCached: 814628 kBSwapCached: 20688 kBActive: 723172 kBInactive: 539364 kBActive(anon): 369736 kBInactive(anon): 14936 kBActive(file): 353436 kBInactive(file): 524428 kBUnevictable: 2080 kBNoswap 292435456 kBMlocked: 2080 kBSwapTotal: 4190964 kBSwapFree: 4072560 kBDirty: 640 kBWriteback: 0 kBAnonPages: 292440380 kBMapped: 144904 kBShmem: 129772 kBSlab: 568552 kBSReclaimable: 483816 kBSUnreclaim: 84736 kBKernelStack: 13776 kBPageTables: 785532 kBNFS_Unstable: 0 kBBounce: 0 kBWritebackTmp: 0 kBCommitLimit: 156197224 kBCommitted_AS: 402420112 kBVmallocTotal: 34359738367 kBVmallocUsed: 17872740 kBVmallocChunk: 34142133244 kBHardwareCorrupted: 0 kBHugePages_Total: 28713HugePages_Free: 14352HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kBDirectMap4k: 6144 kBDirectMap2M: 2017280 kBDirectMap1G: 367001600 kBHow I accounted for current memory state: MemFree + Buffers + Cached + SwapCached + AnonPages + Mapped + Slab + KernelStack + PageTables + vmalloced memory + huge pagesSince 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 | bcReference: http://enakai00.hatenablog.com/entry/20110906/1315315488So vmalloc physical memory consumption works out to be 826376 KB.Huge pages = 28713 * 2048 Kb = 58804224 KBWith 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.
Total available physical memory from /proc/meminfo not adding up
linux;linux kernel;memory;architecture