[LTP] [PATCH v1] mem: disable KSM smart scan for ksm tests

Stefan Roesch
2023-11-27T17:45:49Z

This disables the "smart scan" KSM feature to make sure that the volatile
count remains at 0.

Signed-off-by: Stefan Roesch <devkernel.io>

Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202311161132.13d8ce5a-oliver.sang@intel.com
---
testcases/kernel/mem/lib/mem.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index fbfeef026..ef274a3ac 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -454,6 +454,9 @@ void create_same_memory(int size, int num, int unit)
{'a', size*MB}, {'a', size*MB}, {'d', size*MB}, {'d', size*MB},
};

+ /* Disable smart scan for correct volatile counts. */
+ SAFE_FILE_PRINTF(PATH_KSM "smart_scan", "0");
+
ps = sysconf(_SC_PAGE_SIZE);
pages = MB / ps;

@@ -526,6 +529,7 @@ void create_same_memory(int size, int num, int unit)

tst_res(TINFO, "stop KSM.");
SAFE_FILE_PRINTF(PATH_KSM "run", "0");
+ SAFE_FILE_PRINTF(PATH_KSM "smart_scan", "1");
final_group_check(0, 0, 0, 0, 0, 0, size * pages * num);

while (waitpid(-1, &status, 0) > 0)

base-commit: 8c89ef3d451087ed6e18750bd5eedd10e5ab3d2e
--
2.39.3