]> git.proxmox.com Git - mirror_lxcfs.git/commit
proc: fix MemAvailable in /proc/meminfo to exclude tmpfs files
authorKyeong Yoo <kyeong.yoo@alliedtelesis.co.nz>
Tue, 3 Oct 2023 03:36:51 +0000 (16:36 +1300)
committerKyeong Yoo <kyeong.yoo@alliedtelesis.co.nz>
Tue, 3 Oct 2023 03:36:51 +0000 (16:36 +1300)
commit5340b27fc543a1160dd6b763efe6c2e003b1c21d
tree26ec92f95428d3e2ddece3c0fd4011b671d1d801
parent87a2fe91b87b335579bc955713fb6922d65a5b85
proc: fix MemAvailable in /proc/meminfo to exclude tmpfs files

The "total_cache" from memory.stat of cgroup includes
the memory used by tmpfs files ("total_shmem"). Considering
it as available memory is wrong because files created
on a tmpfs file system cannot be simply reclaimed.

So the available memory is calculated with the sum of:
 * Memory the kernel knows is free
 * Memory that contained in the kernel active file LRU,
   that can be reclaimed if necessary
 * Memory that is contained in the kernel non-active file
   LRU, that can be reclaimed if necessary

Signed-off-by: Kyeong Yoo <kyeong.yoo@alliedtelesis.co.nz>
src/proc_fuse.c