/proc/meminfo: relations of values

From: Oleg
Date: Fri Apr 22 2016 - 10:10:00 EST


Hi, all!

Google has many explanations of what each value mean, but nothing about
relations of values (the same for Documentation/filesystems/proc.txt).

For example, i have qemu vm with x86_64 kernel:

~# dd if=/dev/zero of=tmpdata bs=$((1024*1024)) count=10; sleep 1s; \
free; cat /proc/meminfo; grep Pss: /proc/*/smaps | awk '{s+=$2} END {print s}'
total used free shared buffers cached
Mem: 509728 64172 445556 0 2696 38848
-/+ buffers/cache: 22628 487100
Swap: 0 0 0
MemTotal: 509728 kB
MemFree: 445556 kB
Buffers: 2696 kB
Cached: 38848 kB
SwapCached: 0 kB
Active: 18708 kB
Inactive: 28108 kB
Active(anon): 5284 kB
Inactive(anon): 28 kB
Active(file): 13424 kB
Inactive(file): 28080 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 32 kB
Writeback: 7640 kB
AnonPages: 5292 kB
Mapped: 4232 kB
Shmem: 40 kB
Slab: 8384 kB
SReclaimable: 3232 kB
SUnreclaim: 5152 kB
KernelStack: 424 kB
PageTables: 472 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 254864 kB
Committed_AS: 56380 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 2092 kB
VmallocChunk: 34359732272 kB
DirectMap4k: 10232 kB
DirectMap2M: 514048 kB
10070

If i understand correctly, 10070K is userspace size, but i don't know how can i
get this value from /proc/meminfo - AnonPages + ? ...
A part of 10070K are code segments; are they included in Cached value?
If not, then 22628K(used) - 100070K = 12558K - is this kernel memory?
Which values are compose it(Slab + ?...)?

The only relations i know are:

Active = Active(anon) + Active(file)
Inactive = Inactive(anon) + Inactive(file)
Slab = SReclaimable + SUnreclaim

Others are unknown. For example, i don't know how to get used value - 64172;
and why AnonPages is not equal nor Active(anon) nor Active(anon) + Inactive(anon)?

If anyone have the time for an answer, I will be grateful.

Thanks.

--
ÐÐÐÐÐÐÐ ÐÐÐÐ (Nemanov Oleg)