linux - Total available physical memory from /proc/meminfo not adding up -
i'm trying account available physical memory on linux box through /proc/meminfo (output provided below). accounting current free memory, user-space physical usage, kernel data structures including vmalloc-ed, huge pages etc i'm coming short ~5 gb. meminfo gives me @ 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 accounted current memory state: memfree + buffers + cached + swapcached + anonpages + mapped + slab + kernelstack + pagetables + vmalloced memory + huge pages
since vmallocused throws memory usage of external physical devices remapped (using ioremap) in addition physical memory, actual physical memory component did following:
echo "( $(cat /proc/vmallocinfo | grep vmalloc | awk '{print $2}' | paste -s -d "+") )/ 1024" | bc
reference: http://enakai00.hatenablog.com/entry/20110906/1315315488
so vmalloc physical memory consumption works out 826376 kb.
huge pages = 28713 * 2048 kb = 58804224 kb
with this, i'm coming ~ 5g worth of unaccounted-for memory (comparing memtotal).
if there have not accounted here , explain gap, please let me know.
Comments
Post a Comment