UTSASRG / Scaler

GNU General Public License v2.0
4 stars 0 forks source link

Memory usage statistics #90

Closed GammaPi closed 1 year ago

GammaPi commented 1 year ago

/proc/{pid}/status

VMSize: Virtual memory size VMRss: Physical memory size

Cgroup V1 5.5 usage_in_bytes For efficiency, as other kernel components, memory cgroup uses some optimization to avoid unnecessary cacheline false sharing. usage_in_bytes is affected by the method and doesn't show 'exact' value of memory (and swap) usage, it's a fuzz value for efficient access. (Of course, when necessary, it's synchronized.) If you want to know more exact memory usage, you should use RSS+CACHE(+SWAP) value in memory.stat(see 5.2).

Note: Only anonymous and swap cache memory is listed as part of 'rss' stat. This should not be confused with the true 'resident set size' or the amount of physical memory used by the cgroup. 'rss + mapped_file" will give you resident set size of cgroup. (Note: file and shmem may be shared among other cgroups. In that case, mapped_file is accounted only when the memory cgroup is owner of page cache.)

GammaPi commented 1 year ago

RSS does not include kernel space memory https://stackoverflow.com/questions/22032757/does-rss-include-kernel-space-memory

GammaPi commented 1 year ago

Already implemented this in the latest benchmark toolkit.