<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 24, 2021 at 5:51 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
> Since commit c305a53c5 (lib: limit the size of tmpfs in LTP, Jul 9)<br>
> Ltp set tmpfs mount size according to the tdev.size. This cause a<br>
> new problem on small RAM system, which consume too much memory and<br>
> finally trigger OOM.<br>
> <br>
> To fix this, let's cancel the tmpfs size limitation when MemAvailable<br>
> is less than twofold of tdev.size.<br>
> <br>
> Reported-by: Ralph Siemsen <<a href="mailto:ralph.siemsen@linaro.org" target="_blank">ralph.siemsen@linaro.org</a>><br>
> Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
> ---<br>
> include/tst_test.h | 1 +<br>
> lib/tst_test.c | 3 +++<br>
> 2 files changed, 4 insertions(+)<br>
> <br>
> diff --git a/include/tst_test.h b/include/tst_test.h<br>
> index 5e3619698..3dcb45de0 100644<br>
> --- a/include/tst_test.h<br>
> +++ b/include/tst_test.h<br>
> @@ -42,6 +42,7 @@<br>
> #include "tst_lockdown.h"<br>
> #include "tst_fips.h"<br>
> #include "tst_taint.h"<br>
> +#include "tst_memutils.h"<br>
> <br>
> /*<br>
> * Reports testcase result.<br>
> diff --git a/lib/tst_test.c b/lib/tst_test.c<br>
> index 4224353da..b50856f20 100644<br>
> --- a/lib/tst_test.c<br>
> +++ b/lib/tst_test.c<br>
> @@ -895,6 +895,9 @@ static const char *limit_tmpfs_mount_size(const char *mnt_data,<br>
> if (strcmp(fs_type, "tmpfs"))<br>
> return mnt_data;<br>
> <br>
> + if ((tst_available_mem() / 1024) < (tdev.size * 2))<br>
> + return mnt_data;<br>
<br>
I'm starting to think that we should do it the other way around, i.e.<br>
<br>
<span class="gmail_default" style="font-size:small"></span>- unless the test defines .min_dev_size we should set the size for tmpfs to be really small 16MB or 32MB<br>
- if .min_dev_size is defined and <span class="gmail_default" style="font-size:small"></span>there is not enough free memory -> TCONF<br>
- if .min_dev_size is not set and there is not even 64MB of free memory (for 32MB limit) -> TCONF<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Agree, this is a cogitative handle way. </div><div class="gmail_default" style="font-size:small">At least better than unlimit the tmpfs-size roughly when AvailableMem is short.</div><div class="gmail_default" style="font-size:small"><br></div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I think that this is going to work because most of the tests does not<br>
actually consume more than a megabyte or so of the disk space for the<br>
actuall test, the only reason why we kept bumping the loop device size<br>
is that there are limits on minimal size imposed by filesystems.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">+1 Indeed.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Patch V2 is on the way...</div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>