From: Ralph Siemsen <ralph.siemsen@linaro.org>
To: Li Wang <liwang@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 3/3] lib: adjust the tmpfs size according to .dev_min_size and MemAvailable
Date: Mon, 27 Sep 2021 15:09:51 -0400 [thread overview]
Message-ID: <20210927190951.GC4173236@maple.netwinder.org> (raw)
In-Reply-To: <20210927151220.GB4173236@maple.netwinder.org>
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.
--- 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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-09-27 19:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 7:07 [LTP] [PATCH 1/3] lib: add tst_available_mem function Li Wang
2021-09-24 7:07 ` [LTP] [PATCH 2/3] swapping01: make use of tst_available_mem Li Wang
2021-09-24 14:17 ` Petr Vorel
2021-09-24 7:07 ` [LTP] [PATCH 3/3] lib: unlimit the tmpfs size when test on small systems Li Wang
2021-09-24 9:51 ` Cyril Hrubis
2021-09-24 10:27 ` Li Wang
2021-09-24 10:40 ` Petr Vorel
2021-09-24 10:52 ` [LTP] [PATCH v2 3/3] lib: adjust the tmpfs size according to .dev_min_size and MemAvailable Li Wang
2021-09-24 11:05 ` Cyril Hrubis
2021-09-24 11:32 ` Li Wang
2021-09-24 14:23 ` Petr Vorel
2021-09-27 2:39 ` Li Wang
2021-09-27 15:12 ` Ralph Siemsen
2021-09-27 19:09 ` Ralph Siemsen [this message]
2021-09-28 1:19 ` Li Wang
2021-09-28 2:22 ` Ralph Siemsen
2021-09-28 7:53 ` Li Wang
2021-09-24 14:15 ` [LTP] [PATCH 1/3] lib: add tst_available_mem function Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210927190951.GC4173236@maple.netwinder.org \
--to=ralph.siemsen@linaro.org \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.