All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/7] mem/lib: Export group_check() as ksm_group_check()
Date: Thu,  3 Mar 2022 15:50:27 +0100	[thread overview]
Message-ID: <20220303145032.21493-3-chrubis@suse.cz> (raw)
In-Reply-To: <20220303145032.21493-1-chrubis@suse.cz>

This is preparing for the move of the code from library to the ksm06.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/mem/include/mem.h |  2 ++
 testcases/kernel/mem/lib/mem.c     | 22 +++++++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index f1cba5fcb..776809113 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -50,6 +50,8 @@ void testoom(int mempolicy, int lite, int retcode, int allow_sigkill);
 
 void create_same_memory(int size, int num, int unit);
 void test_ksm_merge_across_nodes(unsigned long nr_pages);
+void ksm_group_check(int run, int pg_shared, int pg_sharing, int pg_volatile,
+                     int pg_unshared, int sleep_msecs, int pages_to_scan);
 
 /* THP */
 
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index ee9fc85b6..102fc5665 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -271,9 +271,9 @@ static void final_group_check(int run, int pages_shared, int pages_sharing,
 	check("pages_to_scan", pages_to_scan);
 }
 
-static void group_check(int run, int pages_shared, int pages_sharing,
-			int pages_volatile, int pages_unshared,
-			int sleep_millisecs, int pages_to_scan)
+void ksm_group_check(int run, int pages_shared, int pages_sharing,
+		     int pages_volatile, int pages_unshared,
+		     int sleep_millisecs, int pages_to_scan)
 {
 	if (run != 1) {
 		tst_res(TFAIL, "group_check run is not 1, %d.", run);
@@ -489,19 +489,19 @@ void create_same_memory(int size, int num, int unit)
 
 	resume_ksm_children(child, num);
 	stop_ksm_children(child, num);
-	group_check(1, 2, size * num * pages - 2, 0, 0, 0, size * pages * num);
+	ksm_group_check(1, 2, size * num * pages - 2, 0, 0, 0, size * pages * num);
 
 	resume_ksm_children(child, num);
 	stop_ksm_children(child, num);
-	group_check(1, 3, size * num * pages - 3, 0, 0, 0, size * pages * num);
+	ksm_group_check(1, 3, size * num * pages - 3, 0, 0, 0, size * pages * num);
 
 	resume_ksm_children(child, num);
 	stop_ksm_children(child, num);
-	group_check(1, 1, size * num * pages - 1, 0, 0, 0, size * pages * num);
+	ksm_group_check(1, 1, size * num * pages - 1, 0, 0, 0, size * pages * num);
 
 	resume_ksm_children(child, num);
 	stop_ksm_children(child, num);
-	group_check(1, 1, size * num * pages - 2, 0, 1, 0, size * pages * num);
+	ksm_group_check(1, 1, size * num * pages - 2, 0, 1, 0, size * pages * num);
 
 	tst_res(TINFO, "KSM unmerging...");
 	SAFE_FILE_PRINTF(PATH_KSM "run", "2");
@@ -586,15 +586,15 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 	tst_res(TINFO, "Start to test KSM with merge_across_nodes=1");
 	SAFE_FILE_PRINTF(PATH_KSM "merge_across_nodes", "1");
 	SAFE_FILE_PRINTF(PATH_KSM "run", "1");
-	group_check(1, 1, nr_pages * num_nodes - 1, 0, 0, 0,
-		    nr_pages * num_nodes);
+	ksm_group_check(1, 1, nr_pages * num_nodes - 1, 0, 0, 0,
+		        nr_pages * num_nodes);
 
 	SAFE_FILE_PRINTF(PATH_KSM "run", "2");
 	tst_res(TINFO, "Start to test KSM with merge_across_nodes=0");
 	SAFE_FILE_PRINTF(PATH_KSM "merge_across_nodes", "0");
 	SAFE_FILE_PRINTF(PATH_KSM "run", "1");
-	group_check(1, num_nodes, nr_pages * num_nodes - num_nodes,
-		    0, 0, 0, nr_pages * num_nodes);
+	ksm_group_check(1, num_nodes, nr_pages * num_nodes - num_nodes,
+		        0, 0, 0, nr_pages * num_nodes);
 
 	SAFE_FILE_PRINTF(PATH_KSM "run", "2");
 
-- 
2.34.1


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

  parent reply	other threads:[~2022-03-03 14:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 14:50 [LTP] [PATCH 0/7] ksm06 and libnuma cleanups and fixes Cyril Hrubis
2022-03-03 14:50 ` [LTP] [PATCH 1/7] ksm06: Move option parsing into the setup() Cyril Hrubis
2022-03-07 13:02   ` Richard Palethorpe
2022-03-03 14:50 ` Cyril Hrubis [this message]
2022-03-07 13:03   ` [LTP] [PATCH 2/7] mem/lib: Export group_check() as ksm_group_check() Richard Palethorpe
2022-03-03 14:50 ` [LTP] [PATCH 3/7] mem/ksm06: Move test code from library to the test Cyril Hrubis
2022-03-07 13:03   ` Richard Palethorpe
2022-03-03 14:50 ` [LTP] [PATCH 4/7] mem/ksm06: SPDX + docparse comment Cyril Hrubis
2022-03-07 13:04   ` Richard Palethorpe
2022-03-03 14:50 ` [LTP] [PATCH 5/7] mem/ksm06: Move ksm restoration into the tst_test struct Cyril Hrubis
2022-03-04  2:27   ` Li Wang
2022-03-04 12:02     ` Cyril Hrubis
2022-03-07  1:44       ` Li Wang
2022-03-07  8:58         ` Cyril Hrubis
2022-03-07  9:06           ` Li Wang
2022-03-07  9:13             ` Cyril Hrubis
2022-03-03 14:50 ` [LTP] [PATCH 6/7] libs: libltpnuma: Fix free memory estimate Cyril Hrubis
2022-03-04  2:56   ` Li Wang
2022-03-03 14:50 ` [LTP] [PATCH 7/7] mem/ksm06: Make use of the new libltpnuma Cyril Hrubis
2022-03-04  3:17   ` Li Wang
2022-03-03 15:06 ` [LTP] [PATCH 0/7] ksm06 and libnuma cleanups and fixes 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=20220303145032.21493-3-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.