selftests/mm: add folio_split() and filemap_get_entry() race test
Subsystems (4)
PATCH v4 1/1 selftests/mm: add folio_split() and filemap_get_entry() race test
The added folio_split_race_test is a modified C port of the race condition test from [1]. The test creates shmem huge pages, where the main thread punches holes in the shmem to cause folio_split() in the kernel and a set of 16 threads reads the shmem to cause filemap_get_entry() in the kernel. filemap_get_entry() reads the folio and xarray split by folio_split() locklessly. The original test[2] is written in rust and uses memfd (shmem backed). This C port uses shmem directly and use a single process.
Note: the initial rust to C conversion is done by Cursor.
---
From V3:
1. fixed for loop stepping issue
2. used PRIu64 instead of %zu for uint64_t.
From V2:
1. simplied the program by removing fork.
From V1:
1. added prctl(PR_SET_PDEATHSIG, SIGTERM) to avoid child looping forever.
2. removed page_idx % PUNCH_INTERVAL >= 0, since it is a nop. Added a comment.
3. added a child process status check to prevent parent looping forever and record that as a failure.
4. used ksft_exit_skip() instead of ksft_finished() when the program is not running as root.
5. restored THP settings properly when the program exits abnormally.
tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/folio_split_race_test.c | 293 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 2 + 3 files changed, 296 insertions(+) create mode 100644 tools/testing/selftests/mm/folio_split_race_test.c
tools/testing/selftests/mm/Makefile +1 -0
@@ -105,6 +105,7 @@ TEST_GEN_FILES += droppable TEST_GEN_FILES += guard-regions TEST_GEN_FILES += merge TEST_GEN_FILES += rmap +TEST_GEN_FILES += folio_split_race_test ifneq ($(ARCH),arm64) TEST_GEN_FILES += soft-dirty
tools/testing/selftests/mm/folio_split_race_test.c new file +293 -0
293 lines not on this page · raw message
tools/testing/selftests/mm/run_vmtests.sh +2 -0
@@ -553,6 +553,8 @@ if [ -n "${MOUNTED_XFS}" ]; then rm -f ${XFS_IMG} fi +CATEGORY="thp" run_test ./folio_split_race_test + CATEGORY="migration" run_test ./migration CATEGORY="mkdirty" run_test ./mkdirty
Signature · 1 line
2.51.0
Quoted 34 lines · Zi Yan
The added
folio_split_race_testis a modified C port of the race condition test from [1]. The test creates shmem huge pages, where the main thread punches holes in the shmem to causefolio_split()in the kernel and a set of 16 threads reads the shmem to causefilemap_get_entry()in the kernel.filemap_get_entry()reads the folio and xarray split byfolio_split()locklessly. The original test[2] is written in rust and uses memfd (shmem backed). This C port uses shmem directly and use a single process.Note: the initial rust to C conversion is done by Cursor.
Link https://lore.kernel.org/all/CAKNNEtw5_kZomhkugedKMPOG-sxs5Q5OLumWJdiWXv+C9Yct0w@mail.gmail.com/ [1] open hereSigned-off-by Bas van Dijk <[email protected]>Signed-off-by Adam Bratschi-Kaye <[email protected]>Signed-off-by Zi Yan <[email protected]>---
From V3:
1. fixed for loop stepping issue
2. used PRIu64 instead of %zu foruint64_t.From V2:
1. simplied the program by removing fork.From V1:
1. addedprctl(PR_SET_PDEATHSIG, SIGTERM)to avoid child looping forever.
2. removedpage_idx%PUNCH_INTERVAL>= 0, since it is a nop. Added a comment.
3. added a child process status check to prevent parent looping forever and record that as a failure.
4. usedksft_exit_skip()instead ofksft_finished()when the program is not running as root.
5. restored THP settings properly when the program exits abnormally.
Quoted 6 lines
tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/folio_split_race_test.c | 293 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 2 + 3 files changed, 296 insertions(+) create mode 100644 tools/testing/selftests/mm/folio_split_race_test.c
Hi Andrew,
The fixup below adds folio_split_race_test binary to .gitignore. Thank Lorenzo for pointing this out.
From bd164a7090c0e8b6e3013502c64c161214e38714 Mon Sep 17 00:00:00 2001
From: Zi Yan <[email protected]>
Date: Fri, 20 Mar 2026 13:56:04 -0400
Subject: [PATCH] git: add generated binary into gitignore
--- tools/testing/selftests/mm/.gitignore | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/mm/.gitignore +1 -0
@@ -61,3 +61,4 @@ guard-regions merge prctl_thp_disable rmap +folio_split_race_test
Signature · 6 lines
2.51.0 Best Regards, Yan, Zi
Quoted 34 lines · Zi Yan
The added
folio_split_race_testis a modified C port of the race condition test from [1]. The test creates shmem huge pages, where the main thread punches holes in the shmem to causefolio_split()in the kernel and a set of 16 threads reads the shmem to causefilemap_get_entry()in the kernel.filemap_get_entry()reads the folio and xarray split byfolio_split()locklessly. The original test[2] is written in rust and uses memfd (shmem backed). This C port uses shmem directly and use a single process.Note: the initial rust to C conversion is done by Cursor.
Link https://lore.kernel.org/all/CAKNNEtw5_kZomhkugedKMPOG-sxs5Q5OLumWJdiWXv+C9Yct0w@mail.gmail.com/ [1] open hereSigned-off-by Bas van Dijk <[email protected]>Signed-off-by Adam Bratschi-Kaye <[email protected]>Signed-off-by Zi Yan <[email protected]>---
From V3:
1. fixed for loop stepping issue
2. used PRIu64 instead of %zu foruint64_t.From V2:
1. simplied the program by removing fork.From V1:
1. addedprctl(PR_SET_PDEATHSIG, SIGTERM)to avoid child looping forever.
2. removedpage_idx%PUNCH_INTERVAL>= 0, since it is a nop. Added a comment.
3. added a child process status check to prevent parent looping forever and record that as a failure.
4. usedksft_exit_skip()instead ofksft_finished()when the program is not running as root.
5. restored THP settings properly when the program exits abnormally.
Quoted 6 lines
tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/folio_split_race_test.c | 293 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 2 + 3 files changed, 296 insertions(+) create mode 100644 tools/testing/selftests/mm/folio_split_race_test.c
Hi Andrew,
The fixup below addressed the new issues (first and third) raised by sashiko[1].
The second issue is that the test only verifies first 8 bytes. Because the test is intended to verify the race condition causing a wrong page index is used.
The fourth issue is addressed in Q3 from V3[2]
[1] https://sashiko.dev/#/patchset/20260320142219.375118-1-ziy%40nvidia.com
[2] https://lore.kernel.org/all/[email protected]/
From a66945de00f33c163cf814ac7c2d9620a725bfed Mon Sep 17 00:00:00 2001
From: Zi Yan <[email protected]>
Date: Sun, 22 Mar 2026 19:53:54 -0400
Subject: [PATCH] selftests/mm: fix sashiko complains on folio_split_race_test
1. used PRIu64 for uint64_t
2. added pthread_barrier_t to ensure main thread starts to punch holes when all reader threads are spawned.
--- .../selftests/mm/folio_split_race_test.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
tools/testing/selftests/mm/folio_split_race_test.c +14 -3
@@ -46,6 +46,7 @@ struct shared_ctl {atomic_uint_fast32_t stop;atomic_size_t reader_failures;atomic_size_t reader_verified; +pthread_barrier_t barrier; };static void fill_page (unsigned char *base,size_t page_idx)
@@ -78,14 +79,14 @@ static bool check_page(unsigned char *base, size_t page_idx) }if (all_zero) {ksft_print_msg ( -"CORRUPTED: page %zu (huge page %zu) is ALL ZEROS\n" , +"CORRUPTED: page %zu (huge page %" PRIu64") is ALL ZEROS\n" , page_idx, (page_idx * page_size) / pmd_pagesize); }else {ksft_print_msg ( -"CORRUPTED: page %zu (huge page %zu): expected idx %zu, got %lu\n" , +"CORRUPTED: page %zu (huge page %" PRIu64"): expected idx %zu, got %" PRIu64"\n" , page_idx, (page_idx * page_size) / pmd_pagesize, - page_idx, (unsigned long )got_idx); + page_idx, got_idx); }return false; }
@@ -110,6 +111,8 @@ static void *reader_thread(void *arg)atomic_size_t *verified = ra->verified;size_t page_idx; +pthread_barrier_wait (&ctl->barrier); +while (atomic_load_explicit (&ctl->stop, memory_order_acquire) ==0 ) {for (page_idx = (size_t )tid; page_idx <TOTAL_PAGES ; page_idx +=NUM_READER_THREADS ) {
@@ -178,8 +181,14 @@ static size_t run_iteration(void)if (!check_huge_shmem (mmap_base,NR_PMD_PAGE , pmd_pagesize))ksft_exit_fail_msg ("No shmem THP is allocated\n" ); +if (pthread_barrier_init (&ctl.barrier,NULL ,NUM_READER_THREADS +1 ) !=0 ) +ksft_exit_fail_msg ("pthread_barrier_init failed\n" ); +create_readers (threads, args, mmap_base, &ctl); +/* Wait for all reader threads to be ready before punching holes. */ +pthread_barrier_wait (&ctl.barrier); +for (i =0 ; i <TOTAL_PAGES ; i++) {if (i %PUNCH_INTERVAL !=0 )continue ;
@@ -198,6 +207,8 @@ static size_t run_iteration(void)for (i =0 ; i <NUM_READER_THREADS ; i++)pthread_join (threads[i],NULL ); +pthread_barrier_destroy (&ctl.barrier); + reader_failures =atomic_load_explicit (&ctl.reader_failures, memory_order_acquire); reader_verified = atomic_load_explicit(&ctl.reader_verified,
Signature · 7 lines
2.53.0 -- Best Regards, Yan, Zi
David Hildenbrand (Arm)
maintainerQuoted 9 lines · Zi Yan
The added
folio_split_race_testis a modified C port of the race condition test from [1]. The test creates shmem huge pages, where the main thread punches holes in the shmem to causefolio_split()in the kernel and a set of 16 threads reads the shmem to causefilemap_get_entry()in the kernel.filemap_get_entry()reads the folio and xarray split byfolio_split()locklessly. The original test[2] is written in rust and uses memfd (shmem backed). This C port uses shmem directly and use a single process.
Quoted 6 lines
Note: the initial rust to C conversion is done by Cursor.
You are likely missing two Co-developed-by.
See Documentation/process/submitting-patches.rst on how to handle such SOBs.
Quoted 61 lines
Signed-off-by Zi Yan <[email protected]>---
From V3:
1. fixed for loop stepping issue
2. used PRIu64 instead of %zu foruint64_t.From V2:
1. simplied the program by removing fork.From V1:
1. addedprctl(PR_SET_PDEATHSIG, SIGTERM)to avoid child looping forever.
2. removedpage_idx%PUNCH_INTERVAL>= 0, since it is a nop. Added a comment.
3. added a child process status check to prevent parent looping forever and record that as a failure.
4. usedksft_exit_skip()instead ofksft_finished()when the program is not running as root.
5. restored THP settings properly when the program exits abnormally.tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/folio_split_race_test.c | 293 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 2 + 3 files changed, 296 insertions(+) create mode 100644 tools/testing/selftests/mm/folio_split_race_test.ctools/testing/selftests/mm/Makefile +1
-0@@ -105,6 +105,7 @@ TEST_GEN_FILES += droppable TEST_GEN_FILES += guard-regions TEST_GEN_FILES += merge TEST_GEN_FILES += rmap +TEST_GEN_FILES += folio_split_race_test ifneq ($(ARCH),arm64) TEST_GEN_FILES += soft-dirtytools/testing/selftests/mm/folio_split_race_test.c new file +18
-0@@ -0,0 +1,293 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* The test creates shmem PMD huge pages, fills all pages with known patterns, +* then continuously verifies non-punched pages with 16 threads. Meanwhile, the +* main thread punches holes via MADV_REMOVE on the shmem. +* +* It tests the race condition between folio_split() and filemap_get_entry(), +* where the hole punches on shmem lead to folio_split() and reading the shmem +* lead to filemap_get_entry(). +*/ + +#define _GNU_SOURCE +#include <errno.h> +#include <inttypes.h> +#include <linux/mman.h> +#include <pthread.h> +#include <stdatomic.h> +#include <stdbool.h>
tools/testing/selftests/mm/folio_split_race_test.c line 28
Quoted 10 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +10
-0+#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <signal.h> +#include <unistd.h> +#include "vm_util.h" +#include "kselftest.h" +#include "thp_settings.h"
[...] some comment son the main() part :)
tools/testing/selftests/mm/folio_split_race_test.c line 236
Quoted 6 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +6
-0+int main (void ) +{ +struct thp_settings current_settings; +bool failed = false; +size_t failures; +size_t iter;
Why are iterations a "size_t" ? Similarly for "failures". Just use int / unsigned long?
tools/testing/selftests/mm/folio_split_race_test.c line 241
Quoted 5 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +5
-0+ +ksft_print_header (); + +if (!thp_is_enabled ()) +ksft_exit_skip ("Transparent Hugepages not available\n" );
Is checking thp_is_enabled() the right thing to do when you perform your own setup below either way?
I think you should just use thp_available(). Then, configure THP accordingly below?
Quoted 10 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +10
-0+ +if (geteuid () !=0 ) +ksft_exit_skip ("Please run the test as root\n" ); + +thp_save_settings (); +/* make sure thp settings are restored */ +if (atexit (thp_settings_cleanup) !=0 ) +ksft_exit_fail_msg ("atexit failed\n" ); + +signal (SIGINT , thp_cleanup_handler);
tools/testing/selftests/mm/folio_split_race_test.c line 261
Quoted 10 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +10
-0+signal (SIGTERM , thp_cleanup_handler); + +thp_read_settings (¤t_settings); + current_settings.shmem_enabled =SHMEM_ADVISE ; +thp_write_settings (¤t_settings); + +ksft_set_plan (1 ); + + page_size =getpagesize (); + pmd_pagesize =read_pmd_pagesize ();
I wonder whether we should check for 0 here and skip the test (older kernels?).
tools/testing/selftests/mm/folio_split_race_test.c line 270
Quoted 9 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +9
-0+ +ksft_print_msg ("folio split race test\n" ); +ksft_print_msg ("===================================================\n" ); +ksft_print_msg ("Shmem size: %" PRIu64" MiB\n" ,FILE_SIZE /1024 /1024 ); +ksft_print_msg ("Total pages: %" PRIu64"\n" ,TOTAL_PAGES ); +ksft_print_msg ("Child readers: %d\n" ,NUM_READER_THREADS ); +ksft_print_msg ("Punching every %dth to %dth page\n" ,PUNCH_INTERVAL , +PUNCH_INTERVAL +PUNCH_SIZE_FACTOR ); +ksft_print_msg ("Iterations: %d\n" ,NUM_ITERATIONS );
I don't think printing static test information is that helpful. Do we need all that at all?
tools/testing/selftests/mm/folio_split_race_test.c line 70
Quoted 2 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +2
-0+ +for (iter =1 ; iter <=NUM_ITERATIONS ; iter++) {
Why not start at 0? You know, to confuse less people :)
for (iter = 0; iter < NUM_ITERATIONS; iter++) {tools/testing/selftests/mm/folio_split_race_test.c line 273
Quoted 1 line
tools/testing/selftests/mm/folio_split_race_test.c new file +1
-0+ failures =run_iteration ();
"corrupted_pages" ?
tools/testing/selftests/mm/folio_split_race_test.c line 275
Quoted 2 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +2
-0+if (failures >0 ) { + failed = true;
Do you really need that variable?
tools/testing/selftests/mm/folio_split_race_test.c line 278
Quoted 3 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +3
-0+ksft_print_msg ( +"FAILED on iteration %zu: %zu pages corrupted by MADV_REMOVE!\n" , + iter, failures);
Can that simply be printed below?
Like
if (iter < NUM_ITERATIONS) {
ksft_test_result_fail("Test failed on iterations %zu: %zu pages ...\n",
iter + 1, corrupted_pages);
} else { ksft_test_result_pass ...
}
Quoted 14 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +14
-0+break ; + } + } + +if (failed) { +ksft_test_result_fail ("Test failed\n" ); +ksft_exit_fail (); + }else { +ksft_test_result_pass ("All %d iterations passed\n" , +NUM_ITERATIONS ); +ksft_exit_pass (); + } + +return 0 ;
Signature · 3 lines
Cheers, David
Quoted 17 lines · David Hildenbrand (Arm)
Quoted 9 lines · Zi Yan
The added
folio_split_race_testis a modified C port of the race condition test from [1]. The test creates shmem huge pages, where the main thread punches holes in the shmem to causefolio_split()in the kernel and a set of 16 threads reads the shmem to causefilemap_get_entry()in the kernel.filemap_get_entry()reads the folio and xarray split byfolio_split()locklessly. The original test[2] is written in rust and uses memfd (shmem backed). This C port uses shmem directly and use a single process.Quoted 6 lines
Note: the initial rust to C conversion is done by Cursor.
Quoted 4 lines
You are likely missing two Co-developed-by.
See
Documentation/process/submitting-patches.rston how to handle such SOBs.
Will add them.
Quoted 76 lines
Quoted 62 lines
Signed-off-by Zi Yan <[email protected]>---
From V3:
1. fixed for loop stepping issue
2. used PRIu64 instead of %zu foruint64_t.From V2:
1. simplied the program by removing fork.From V1:
1. addedprctl(PR_SET_PDEATHSIG, SIGTERM)to avoid child looping forever.
2. removedpage_idx%PUNCH_INTERVAL>= 0, since it is a nop. Added a comment.
3. added a child process status check to prevent parent looping forever and record that as a failure.
4. usedksft_exit_skip()instead ofksft_finished()when the program is not running as root.
5. restored THP settings properly when the program exits abnormally.tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/folio_split_race_test.c | 293 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 2 + 3 files changed, 296 insertions(+) create mode 100644 tools/testing/selftests/mm/folio_split_race_test.ctools/testing/selftests/mm/Makefile +1
-0@@ -105,6 +105,7 @@ TEST_GEN_FILES += droppable TEST_GEN_FILES += guard-regions TEST_GEN_FILES += merge TEST_GEN_FILES += rmap +TEST_GEN_FILES += folio_split_race_test ifneq ($(ARCH),arm64) TEST_GEN_FILES += soft-dirtytools/testing/selftests/mm/folio_split_race_test.c new file +18
-0@@ -0,0 +1,293 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* The test creates shmem PMD huge pages, fills all pages with known patterns, +* then continuously verifies non-punched pages with 16 threads. Meanwhile, the +* main thread punches holes via MADV_REMOVE on the shmem. +* +* It tests the race condition between folio_split() and filemap_get_entry(), +* where the hole punches on shmem lead to folio_split() and reading the shmem +* lead to filemap_get_entry(). +*/ + +#define _GNU_SOURCE +#include <errno.h> +#include <inttypes.h> +#include <linux/mman.h> +#include <pthread.h> +#include <stdatomic.h> +#include <stdbool.h> tools/testing/selftests/mm/folio_split_race_test.c line 28
Quoted 10 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +10
-0+#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <signal.h> +#include <unistd.h> +#include "vm_util.h" +#include "kselftest.h" +#include "thp_settings.h" [...] some comment son the
main()part :)
Quoted 8 lines
tools/testing/selftests/mm/folio_split_race_test.c line 236
Quoted 6 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +6
-0+int main (void ) +{ +struct thp_settings current_settings; +bool failed = false; +size_t failures; +size_t iter;Why are iterations a "
size_t" ? Similarly for "failures". Just use int / unsigned long?
Will change them.
Quoted 10 lines
tools/testing/selftests/mm/folio_split_race_test.c line 241
Quoted 6 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +5
-0+ +ksft_print_header (); + +if (!thp_is_enabled ()) +ksft_exit_skip ("Transparent Hugepages not available\n" );Is checking
thp_is_enabled()the right thing to do when you perform your own setup below either way?I think you should just use
thp_available(). Then, configure THP accordingly below?
OK, will use thp_available().
Quoted 15 lines
Quoted 15 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +14
-0+ +if (geteuid () !=0 ) +ksft_exit_skip ("Please run the test as root\n" ); + +thp_save_settings (); +/* make sure thp settings are restored */ +if (atexit (thp_settings_cleanup) !=0 ) +ksft_exit_fail_msg ("atexit failed\n" ); + +signal (SIGINT , thp_cleanup_handler); +signal (SIGTERM , thp_cleanup_handler); + +thp_read_settings (¤t_settings); + current_settings.shmem_enabled =SHMEM_ADVISE ;
Quoted 8 lines
tools/testing/selftests/mm/folio_split_race_test.c line 261
Quoted 6 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +6
-0+thp_write_settings (¤t_settings); + +ksft_set_plan (1 ); + + page_size =getpagesize (); + pmd_pagesize =read_pmd_pagesize ();I wonder whether we should check for 0 here and skip the test (older kernels?).
OK, will take care of that.
Quoted 14 lines
tools/testing/selftests/mm/folio_split_race_test.c line 270
Quoted 10 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +9
-0+ +ksft_print_msg ("folio split race test\n" ); +ksft_print_msg ("===================================================\n" ); +ksft_print_msg ("Shmem size: %" PRIu64" MiB\n" ,FILE_SIZE /1024 /1024 ); +ksft_print_msg ("Total pages: %" PRIu64"\n" ,TOTAL_PAGES ); +ksft_print_msg ("Child readers: %d\n" ,NUM_READER_THREADS ); +ksft_print_msg ("Punching every %dth to %dth page\n" ,PUNCH_INTERVAL , +PUNCH_INTERVAL +PUNCH_SIZE_FACTOR ); +ksft_print_msg ("Iterations: %d\n" ,NUM_ITERATIONS );I don't think printing static test information is that helpful. Do we need all that at all?
To provide some information on what this test is doing? I am OK with removing them, but one will need to check the source code to get an idea.
Quoted 8 lines
tools/testing/selftests/mm/folio_split_race_test.c line 70
Quoted 4 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +2
-0+ +for (iter =1 ; iter <=NUM_ITERATIONS ; iter++) {Why not start at 0? You know, to confuse less people :)
for (iter = 0; iter < NUM_ITERATIONS; iter++) {
Will change it.
Quoted 16 lines
tools/testing/selftests/mm/folio_split_race_test.c line 273
Quoted 2 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +1
-0+ failures =run_iteration ();"
corrupted_pages" ?tools/testing/selftests/mm/folio_split_race_test.c line 275
Quoted 2 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +2
-0+if (failures >0 ) { + failed = true;Do you really need that variable?
tools/testing/selftests/mm/folio_split_race_test.c line 278
Quoted 3 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +3
-0+ksft_print_msg ( +"FAILED on iteration %zu: %zu pages corrupted by MADV_REMOVE!\n" , + iter, failures);Can that simply be printed below?
Quoted 9 lines
Like
if (iter < NUM_ITERATIONS) { ksft_test_result_fail("Test failed on iterations %zu: %zu pages ...\n", iter + 1, corrupted_pages); } else {
ksft_test_result_pass...
}
Sure, will simplify it. Thanks for the feedback.
Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +6
-0+break ; + } + } + +if (failed) { +ksft_test_result_fail ("Test failed\n" );
Quoted 12 lines
Quoted 8 lines
tools/testing/selftests/mm/folio_split_race_test.c new file +8
-0+ksft_exit_fail (); + }else { +ksft_test_result_pass ("All %d iterations passed\n" , +NUM_ITERATIONS ); +ksft_exit_pass (); + } + +return 0 ;Signature · 3 lines
Cheers, David
Best Regards,
Yan, Zi