[LTP] [PATCH 3/3] lib: unlimit the tmpfs size when test on small systems
Li Wang
liwang@redhat.com
Fri Sep 24 12:27:49 CEST 2021
On Fri, Sep 24, 2021 at 5:51 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > Since commit c305a53c5 (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 cancel the tmpfs size limitation when MemAvailable
> > is less than twofold of tdev.size.
> >
> > Reported-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> > include/tst_test.h | 1 +
> > lib/tst_test.c | 3 +++
> > 2 files changed, 4 insertions(+)
> >
> > diff --git a/include/tst_test.h b/include/tst_test.h
> > index 5e3619698..3dcb45de0 100644
> > --- a/include/tst_test.h
> > +++ b/include/tst_test.h
> > @@ -42,6 +42,7 @@
> > #include "tst_lockdown.h"
> > #include "tst_fips.h"
> > #include "tst_taint.h"
> > +#include "tst_memutils.h"
> >
> > /*
> > * Reports testcase result.
> > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > index 4224353da..b50856f20 100644
> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -895,6 +895,9 @@ static const char *limit_tmpfs_mount_size(const char
> *mnt_data,
> > if (strcmp(fs_type, "tmpfs"))
> > return mnt_data;
> >
> > + if ((tst_available_mem() / 1024) < (tdev.size * 2))
> > + return mnt_data;
>
> I'm starting to think that we should do it the other way around, i.e.
>
> - unless the test defines .min_dev_size we should set the size for tmpfs
> to be really small 16MB or 32MB
> - if .min_dev_size is defined and there is not enough free memory -> TCONF
> - if .min_dev_size is not set and there is not even 64MB of free memory
> (for 32MB limit) -> TCONF
>
Agree, this is a cogitative handle way.
At least better than unlimit the tmpfs-size roughly when AvailableMem is
short.
> I think that this is going to work because most of the tests does not
> actually consume more than a megabyte or so of the disk space for the
> actuall test, the only reason why we kept bumping the loop device size
> is that there are limits on minimal size imposed by filesystems.
>
+1 Indeed.
Patch V2 is on the way...
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210924/07d40819/attachment.htm>
More information about the ltp
mailing list