lxc / lxcfs

FUSE filesystem for LXC
https://linuxcontainers.org/lxcfs
Other
1.02k stars 246 forks source link

proc: fix MemAvailable in /proc/meminfo to exclude tmpfs files #615

Closed kyeongy closed 9 months ago

kyeongy commented 9 months ago

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:

mihalicyn commented 9 months ago

Considering it as available memory is wrong because files created on a tmpfs file system cannot be simply reclaimed.

It can be reclaimed in fact (to the swap).

But anyways, this change looks good to me.

Thanks!