public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/3] swapping01: make use of tst_available_mem
Date: Fri, 24 Sep 2021 15:07:55 +0800	[thread overview]
Message-ID: <20210924070756.3916953-2-liwang@redhat.com> (raw)
In-Reply-To: <20210924070756.3916953-1-liwang@redhat.com>

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/mem/include/mem.h         | 1 +
 testcases/kernel/mem/swapping/swapping01.c | 6 +-----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 10712cf0c..f995f45b0 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -4,6 +4,7 @@
 #include "tst_test.h"
 #include "tst_cgroup.h"
 #include "ksm_helper.h"
+#include "tst_memutils.h"
 
 #if defined(__powerpc__) || defined(__powerpc64__)
 #define MAXNODES		256
diff --git a/testcases/kernel/mem/swapping/swapping01.c b/testcases/kernel/mem/swapping/swapping01.c
index 66fc65cbe..392b79d65 100644
--- a/testcases/kernel/mem/swapping/swapping01.c
+++ b/testcases/kernel/mem/swapping/swapping01.c
@@ -83,11 +83,7 @@ static void test_swapping(void)
 static void init_meminfo(void)
 {
 	swap_free_init = SAFE_READ_MEMINFO("SwapFree:");
-	if (FILE_LINES_SCANF("/proc/meminfo", "MemAvailable: %ld",
-		&mem_available_init)) {
-		mem_available_init = SAFE_READ_MEMINFO("MemFree:")
-			+ SAFE_READ_MEMINFO("Cached:");
-	}
+	mem_available_init = tst_available_mem();
 	mem_over = mem_available_init * COE_SLIGHT_OVER;
 	mem_over_max = mem_available_init * COE_DELTA;
 
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2021-09-24  7:08 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 ` Li Wang [this message]
2021-09-24 14:17   ` [LTP] [PATCH 2/3] swapping01: make use of tst_available_mem 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
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=20210924070756.3916953-2-liwang@redhat.com \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox