Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: adjust the tmpfs size according to .dev_min_size and MemAvailable
Since commit c305a53 (lib: limit the size of tmpfs in LTP, Jul 9) Ltp set tmpfs mount size according to the tdev.size. This cause a new problem on small RAM system, which consume too much memory and finally trigger OOM. To fix this, let's adjust the tmpfs-size according to both free memory and .dev_min_size: - if .dev_min_size is defined and system has enough free memory, set tmpfs-size to tdev.size - if .dev_min_size is defined and there is not enough free memory -> TCONF - if the test not define .dev_min_size, set the size for tmpfs to be really small 32MB - if .dev_min_size is not define and there is not even 64MB of free memory (for 32MB limit) -> TCONF Reported-by: Ralph Siemsen <ralph.siemsen@linaro.org> Fixes: c305a53 ("lib: limit the size of tmpfs in LTP") Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Li Wang <liwang@redhat.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Petr Vorel <pvorel@suse.cz>
- Loading branch information