On Mon, Aug 26, 2024 at 5:46 AM Yunsheng Lin [off-list ref] wrote:
The testing is done by ensuring that the fragment allocated
from a frag_frag_cache instance is pushed into a ptr_ring
instance in a kthread binded to a specified cpu, and a kthread
binded to a specified cpu will pop the fragment from the
ptr_ring and free the fragment.
CC: Alexander Duyck <redacted>
Signed-off-by: Yunsheng Lin <redacted>
---
tools/testing/selftests/mm/Makefile | 2 +
tools/testing/selftests/mm/page_frag/Makefile | 18 ++
.../selftests/mm/page_frag/page_frag_test.c | 170 ++++++++++++++++++
tools/testing/selftests/mm/run_vmtests.sh | 9 +-
4 files changed, 198 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/mm/page_frag/Makefile
create mode 100644 tools/testing/selftests/mm/page_frag/page_frag_test.c
...
I am good with everything up to this point.
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index 36045edb10de..9a788d5f3f28 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -75,6 +75,8 @@ separated by spaces:
read-only VMAs
- mdwe
test prctl(PR_SET_MDWE, ...)
+- page_frag
+ test handling of page fragment allocation and freeing
example: ./run_vmtests.sh -t "hmm mmap ksm"
EOF@@ -231,7 +233,8 @@ run_test() {
("$@" 2>&1) | tap_prefix
local ret=${PIPESTATUS[0]}
count_total=$(( count_total + 1 ))
- if [ $ret -eq 0 ]; then
+ # page_frag_test.ko returns 11(EAGAIN) when insmod'ing to avoid rmmod
+ if [ $ret -eq 0 ] | [ $ret -eq 11 -a ${CATEGORY} == "page_frag" ]; then
count_pass=$(( count_pass + 1 ))
echo "[PASS]" | tap_prefix
echo "ok ${count_total} ${test}" | tap_output@@ -456,6 +459,10 @@ CATEGORY="mkdirty" run_test ./mkdirty
CATEGORY="mdwe" run_test ./mdwe_test
+CATEGORY="page_frag" run_test insmod ./page_frag/page_frag_test.ko
+
+CATEGORY="page_frag" run_test insmod ./page_frag/page_frag_test.ko test_alloc_len=12 test_align=1
+
echo "SUMMARY: PASS=${count_pass} SKIP=${count_skip} FAIL=${count_fail}" | tap_prefix
echo "1..${count_total}" | tap_output
I don't know if this piece is needed. My thought would be rather than
mess with the run_vmtest.sh directly which is more of a pass/fail test
it might be better to handle this more like test_vmalloc.sh and just
put together your own performance test that you can run to collect the
data, and then if you want to be a part of this test you could call
that script from here.