* [PATCH 0/3] selftests: vm: a few fixup patches
@ 2022-05-21 8:38 Patrick Wang
2022-05-21 8:38 ` [PATCH 1/3] selftests: vm: check numa_available() before operating "merge_across_nodes" in ksm_tests Patrick Wang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Patrick Wang @ 2022-05-21 8:38 UTC (permalink / raw)
To: akpm, shuah; +Cc: linux-mm, linux-kselftest, linux-kernel, patrick.wang.shcn
This series contains three fixup patches for vm selftests. They
are independent. Please see the patches.
Patrick Wang (3):
selftests: vm: check numa_available() before operating
"merge_across_nodes" in ksm_tests
selftests: vm: add "test_hmm.sh" to TEST_FILES
selftests: vm: add the "settings" file with timeout variable
tools/testing/selftests/vm/Makefile | 1 +
tools/testing/selftests/vm/ksm_tests.c | 9 ++++++---
tools/testing/selftests/vm/settings | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/vm/settings
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] selftests: vm: check numa_available() before operating "merge_across_nodes" in ksm_tests
2022-05-21 8:38 [PATCH 0/3] selftests: vm: a few fixup patches Patrick Wang
@ 2022-05-21 8:38 ` Patrick Wang
2022-05-21 8:38 ` [PATCH 2/3] selftests: vm: add "test_hmm.sh" to TEST_FILES Patrick Wang
2022-05-21 8:38 ` [PATCH 3/3] selftests: vm: add the "settings" file with timeout variable Patrick Wang
2 siblings, 0 replies; 4+ messages in thread
From: Patrick Wang @ 2022-05-21 8:38 UTC (permalink / raw)
To: akpm, shuah; +Cc: linux-mm, linux-kselftest, linux-kernel, patrick.wang.shcn
Currently, ksm_tests operates "merge_across_nodes" with NUMA either
enabled or disabled. In a system with NUMA disabled, these operations
will fail and output a misleading report given "merge_across_nodes" does
not exist in sysfs:
----------------------------
running ./ksm_tests -M -p 10
----------------------------
f /sys/kernel/mm/ksm/merge_across_nodes
fopen: No such file or directory
Cannot save default tunables
[FAIL]
----------------------
So check numa_available() before those operations to skip them if NUMA
is disabled.
Signed-off-by: Patrick Wang <patrick.wang.shcn@gmail.com>
---
tools/testing/selftests/vm/ksm_tests.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
index fd85f15869d1..2fcf24312da8 100644
--- a/tools/testing/selftests/vm/ksm_tests.c
+++ b/tools/testing/selftests/vm/ksm_tests.c
@@ -221,7 +221,8 @@ static bool assert_ksm_pages_count(long dupl_page_count)
static int ksm_save_def(struct ksm_sysfs *ksm_sysfs)
{
if (ksm_read_sysfs(KSM_FP("max_page_sharing"), &ksm_sysfs->max_page_sharing) ||
- ksm_read_sysfs(KSM_FP("merge_across_nodes"), &ksm_sysfs->merge_across_nodes) ||
+ numa_available() ? 0 :
+ ksm_read_sysfs(KSM_FP("merge_across_nodes"), &ksm_sysfs->merge_across_nodes) ||
ksm_read_sysfs(KSM_FP("sleep_millisecs"), &ksm_sysfs->sleep_millisecs) ||
ksm_read_sysfs(KSM_FP("pages_to_scan"), &ksm_sysfs->pages_to_scan) ||
ksm_read_sysfs(KSM_FP("run"), &ksm_sysfs->run) ||
@@ -236,7 +237,8 @@ static int ksm_save_def(struct ksm_sysfs *ksm_sysfs)
static int ksm_restore(struct ksm_sysfs *ksm_sysfs)
{
if (ksm_write_sysfs(KSM_FP("max_page_sharing"), ksm_sysfs->max_page_sharing) ||
- ksm_write_sysfs(KSM_FP("merge_across_nodes"), ksm_sysfs->merge_across_nodes) ||
+ numa_available() ? 0 :
+ ksm_write_sysfs(KSM_FP("merge_across_nodes"), ksm_sysfs->merge_across_nodes) ||
ksm_write_sysfs(KSM_FP("pages_to_scan"), ksm_sysfs->pages_to_scan) ||
ksm_write_sysfs(KSM_FP("run"), ksm_sysfs->run) ||
ksm_write_sysfs(KSM_FP("sleep_millisecs"), ksm_sysfs->sleep_millisecs) ||
@@ -720,7 +722,8 @@ int main(int argc, char *argv[])
if (ksm_write_sysfs(KSM_FP("run"), 2) ||
ksm_write_sysfs(KSM_FP("sleep_millisecs"), 0) ||
- ksm_write_sysfs(KSM_FP("merge_across_nodes"), 1) ||
+ numa_available() ? 0 :
+ ksm_write_sysfs(KSM_FP("merge_across_nodes"), 1) ||
ksm_write_sysfs(KSM_FP("pages_to_scan"), page_count))
return KSFT_FAIL;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] selftests: vm: add "test_hmm.sh" to TEST_FILES
2022-05-21 8:38 [PATCH 0/3] selftests: vm: a few fixup patches Patrick Wang
2022-05-21 8:38 ` [PATCH 1/3] selftests: vm: check numa_available() before operating "merge_across_nodes" in ksm_tests Patrick Wang
@ 2022-05-21 8:38 ` Patrick Wang
2022-05-21 8:38 ` [PATCH 3/3] selftests: vm: add the "settings" file with timeout variable Patrick Wang
2 siblings, 0 replies; 4+ messages in thread
From: Patrick Wang @ 2022-05-21 8:38 UTC (permalink / raw)
To: akpm, shuah; +Cc: linux-mm, linux-kselftest, linux-kernel, patrick.wang.shcn
The "test_hmm.sh" file used by run_vmtests.sh dose not be installed
into INSTALL_PATH. Thus run_vmtests.sh can not call it in INSTALL_PATH:
---------------------------
running ./test_hmm.sh smoke
---------------------------
./run_vmtests.sh: line 74: ./test_hmm.sh: No such file or directory
[FAIL]
-----------------------
Add "test_hmm.sh" to TEST_FILES so that it will be installed.
Signed-off-by: Patrick Wang <patrick.wang.shcn@gmail.com>
---
tools/testing/selftests/vm/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 12897927311e..44f25acfbeca 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -92,6 +92,7 @@ endif
TEST_PROGS := run_vmtests.sh
TEST_FILES := test_vmalloc.sh
+TEST_FILES += test_hmm.sh
KSFT_KHDR_INSTALL := 1
include ../lib.mk
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] selftests: vm: add the "settings" file with timeout variable
2022-05-21 8:38 [PATCH 0/3] selftests: vm: a few fixup patches Patrick Wang
2022-05-21 8:38 ` [PATCH 1/3] selftests: vm: check numa_available() before operating "merge_across_nodes" in ksm_tests Patrick Wang
2022-05-21 8:38 ` [PATCH 2/3] selftests: vm: add "test_hmm.sh" to TEST_FILES Patrick Wang
@ 2022-05-21 8:38 ` Patrick Wang
2 siblings, 0 replies; 4+ messages in thread
From: Patrick Wang @ 2022-05-21 8:38 UTC (permalink / raw)
To: akpm, shuah; +Cc: linux-mm, linux-kselftest, linux-kernel, patrick.wang.shcn
The default "timeout" for one kselftest is 45 seconds, while some
cases in run_vmtests.sh require more time. This will cause testing
timeout like:
not ok 4 selftests: vm: run_vmtests.sh # TIMEOUT 45 seconds
Therefore, add the "settings" file with timeout variable so users can
set the "timeout" value.
Signed-off-by: Patrick Wang <patrick.wang.shcn@gmail.com>
---
tools/testing/selftests/vm/settings | 1 +
1 file changed, 1 insertion(+)
create mode 100644 tools/testing/selftests/vm/settings
diff --git a/tools/testing/selftests/vm/settings b/tools/testing/selftests/vm/settings
new file mode 100644
index 000000000000..9abfc60e9e6f
--- /dev/null
+++ b/tools/testing/selftests/vm/settings
@@ -0,0 +1 @@
+timeout=45
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-21 8:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 8:38 [PATCH 0/3] selftests: vm: a few fixup patches Patrick Wang
2022-05-21 8:38 ` [PATCH 1/3] selftests: vm: check numa_available() before operating "merge_across_nodes" in ksm_tests Patrick Wang
2022-05-21 8:38 ` [PATCH 2/3] selftests: vm: add "test_hmm.sh" to TEST_FILES Patrick Wang
2022-05-21 8:38 ` [PATCH 3/3] selftests: vm: add the "settings" file with timeout variable Patrick Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).