All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes.
Date: Wed,  3 May 2017 14:42:33 +0200	[thread overview]
Message-ID: <20170503124233.18585-1-chrubis@suse.cz> (raw)

* Do not multiply free ram with 1024

  - Since we get overflow even on fairly modest
    machine with a few GB of RAM and the test
    will always report "Not enough RAM".

* Drop caches before the test

  - Otherwise the move_pages() syscalls may
    fail with ENOMEM.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/move_pages/move_pages12.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index eeec489..b3ebb7c 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -139,13 +139,17 @@ static void setup(void)
 
 	pgsz = (int)get_page_size();
 	SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "Hugepagesize: %d", &hpsz);
-	hpsz *= 1024;
+
+	SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "1");
 
 	SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "MemFree: %d", &memfree);
-	memfree *= 1024;
+	tst_res(TINFO, "Free RAM %d kB", memfree);
+
 	if (4 * hpsz > memfree)
 		tst_brk(TBROK, "Not enough free RAM");
 
+	hpsz *= 1024;
+
 	SAFE_FILE_SCANF(PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
 	SAFE_FILE_PRINTF(PATH_NR_HUGEPAGES, "%ld", orig_hugepages + 4);
 
-- 
2.7.3


             reply	other threads:[~2017-05-03 12:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 12:42 Cyril Hrubis [this message]
2017-05-04 18:57 ` [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes Jan Stancek
2017-05-05 12:55   ` Cyril Hrubis

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=20170503124233.18585-1-chrubis@suse.cz \
    --to=chrubis@suse.cz \
    --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.