[LTP] [PATCH v2 3/3] lib: adjust the tmpfs size according to .dev_min_size and MemAvailable

Li Wang liwang@redhat.com
Tue Sep 28 03:19:28 CEST 2021


Hi Ralph,

On Tue, Sep 28, 2021 at 3:09 AM Ralph Siemsen <ralph.siemsen@linaro.org>
wrote:

> On Mon, Sep 27, 2021 at 11:12:20AM -0400, Ralph Siemsen wrote:
> >
> >However fallocate06 test is failing with OOM. It seems this one still
> >contains .dev_min_size = 512 , should this be removed?
>
> With .dev_min_size = 512 the test should be skipped on my system since I
> have only ~120 MB of free RAM. But something is wrong with the test.
>
> I added code to print the value returned by tst_available() and found
> that it was a very very large number.
>
> After investigation, the format string "%ld" seems to be the culprit.
>

Thanks for the debugging. Can you send a patch?



>
> --- a/lib/tst_memutils.c
> +++ b/lib/tst_memutils.c
> @@ -65,13 +65,15 @@ void tst_pollute_memory(size_t maxsize, int fillchar)
>
>   long long tst_available_mem(void)
>   {
> -       long long mem_available;
> +       long long mem_available = 0;
>
> -       if (FILE_LINES_SCANF("/proc/meminfo", "MemAvailable: %ld",
> +       if (FILE_LINES_SCANF("/proc/meminfo", "MemAvailable: %lld",
>                 &mem_available)) {
>                 mem_available = SAFE_READ_MEMINFO("MemFree:")
>                         + SAFE_READ_MEMINFO("Cached:");
>         }
>
> +       tst_res(TINFO, "RFS: tst_available_mem returning %lld\n",
> mem_available);
> +
>         return mem_available;
>   }
>
> With the above change, tst_available() returns a reasonable value, and
> the fallocate06 test is skipped:
>
> tst_test.c:1436: TINFO: Testing on tmpfs
> tst_test.c:937: TINFO: Skipping mkfs for TMPFS filesystem
> tst_memutils.c:81: TINFO: RFS: tst_available_mem return 120592
> tst_test.c:907: TINFO: RFS: tmpfs_size = 512 avail=120592
> tst_test.c:911: TCONF: No enough memory for tmpfs use
>
>
> Also, when I remove the .dev_min_size=512 from fallocate06, then it uses
> the default size of 32MB, and the fallocate06 test runs and passes.
>
> Regards,
> Ralph
>
>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210928/3b14b165/attachment-0001.htm>


More information about the ltp mailing list