<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 3, 2022 at 10:49 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>><br>
---<br>
 testcases/kernel/mem/ksm/ksm06.c | 28 +++-------------------------<br>
 1 file changed, 3 insertions(+), 25 deletions(-)<br>
<br>
diff --git a/testcases/kernel/mem/ksm/ksm06.c b/testcases/kernel/mem/ksm/ksm06.c<br>
index 61507b2aa..f5f7319d7 100644<br>
--- a/testcases/kernel/mem/ksm/ksm06.c<br>
+++ b/testcases/kernel/mem/ksm/ksm06.c<br>
@@ -39,9 +39,6 @@<br>
 #ifdef HAVE_NUMA_V2<br>
 #include <numaif.h><br>
<br>
-static int run = -1;<br>
-static int sleep_millisecs = -1;<br>
-static int merge_across_nodes = -1;<br>
 static unsigned long nr_pages = 100;<br>
<br>
 static char *n_opt;<br>
@@ -141,27 +138,6 @@ static void setup(void)<br>
<br>
        if (n_opt)<br>
                nr_pages = SAFE_STRTOUL(n_opt, 0, ULONG_MAX);<br>
-<br>
-       /* save the current value */<br>
-       SAFE_FILE_SCANF(PATH_KSM "run", "%d", &run);<br>
-       SAFE_FILE_SCANF(PATH_KSM "merge_across_nodes",<br>
-                       "%d", &merge_across_nodes);<br>
-       SAFE_FILE_SCANF(PATH_KSM "sleep_millisecs",<br>
-                       "%d", &sleep_millisecs);<br>
-}<br>
-<br>
-static void cleanup(void)<br>
-{<br>
-       if (merge_across_nodes != -1) {<br>
-               FILE_PRINTF(PATH_KSM "merge_across_nodes",<br>
-                           "%d", merge_across_nodes);<br>
-       }<br>
-<br>
-       if (sleep_millisecs != -1)<br>
-               FILE_PRINTF(PATH_KSM "sleep_millisecs", "%d", sleep_millisecs);<br>
-<br>
-       if (run != -1)<br>
-               FILE_PRINTF(PATH_KSM "run", "%d", run);<br>
 }<br>
<br>
 static struct tst_test test = {<br>
@@ -171,9 +147,11 @@ static struct tst_test test = {<br>
                {}<br>
        },<br>
        .setup = setup,<br>
-       .cleanup = cleanup,<br>
        .save_restore = (const char * const[]) {<br>
                "?/sys/kernel/mm/ksm/max_page_sharing",<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">The mem library verifies the max_page_sharing validity before</div><div class="gmail_default" style="font-size:small">setting because some old kernels do not have it. Thus it is fine</div><div class="gmail_default" style="font-size:small">to use the prefix '?'.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               "?/sys/kernel/mm/ksm/run",<br>
+               "?/sys/kernel/mm/ksm/merge_across_nodes",<br>
+               "?/sys/kernel/mm/ksm/sleep_millisecs",<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">But for the two knobs(run, sleep_millisecs) that should exist unless</div><div class="gmail_default" style="font-size:small">the kernel disables KSM. So here we'd better start with prefix '!' and</div><div class="gmail_default" style="font-size:small">add .needs_kconfg for ‘CONFIG_KSM=y' check.</div></div><div class="gmail_default" style="font-size:small">(This also fit for other ksm tests)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">For 'merge_across_nodes', we don't need any prefix because</div><div class="gmail_default" style="font-size:small">ksm06 is actually relying on it, otherwise TCONF is expected. </div><div class="gmail_default" style="font-size:small">Thus it's fine to remove the file check from setup() as well.</div><div><div class="gmail_default" style="font-size:small"></div><br></div></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>