linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.3k stars 1.01k forks source link

stress/memcg_stress_test.sh mem calculate should be MemAvailable? #913

Closed onier closed 2 years ago

onier commented 2 years ago

https://github.com/linux-test-project/ltp/blob/20220121/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh#L32
from the kernel document https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt?id=34e431b0ae398fc54ea69ff85ec700722c9da773#n802

MemFree: The sum of LowFree+HighFree
but only high memory for the userspace. so if calculate the mem for userspace application according to the kernel document should be MemAvailable.

metan-ucw commented 2 years ago

Not at all, it's the other way around, the LowFree memory is available both to the kernel and user space. There is a different problem though MemFree is usually somewhat smaller than usable memory since on usual system there is quite a bit of page cache that can be actually dropped. The MemAvailable tries to somehow account for that as well. However any of these numbers are rough estimates and cannot be trusted too much.