selftests-mm-fix-and-speedup-droppable-test.patch removed from -mm tree
The quilt patch titled
Subject: selftests: mm: fix and speedup "droppable" test
has been removed from the -mm tree. Its filename was
selftests-mm-fix-and-speedup-droppable-test.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "David Hildenbrand (Arm)" <[email protected]>
Subject: selftests: mm: fix and speedup "droppable" test
Date: Thu, 11 Jun 2026 12:01:55 +0200
The droppable test currently relies on creating memory pressure in a child process to trigger dropping the droppable pages.
That not only takes a long time on some machines (allocating and filling all that memory), on large machines this will not work as we hardcode the area size to 134217728 bytes.
... further, we rely on timeouts to detect that memory was not dropped, which is really suboptimal.
Instead, let's just use MADV_PAGEOUT on a 2 MiB region. MADV_PAGEOUT works with droppable memory even without swap.
There is the low chance of MADV_PAGEOUT failing to drop a page because of speculative references. We'll wait 1s and retry 10 times to rule that unlikely case out as best as we can.
On a machine without swap:
$ ./droppable TAP version 13 1..1 ok 1 madvise(MADV_PAGEOUT) behavior # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
---
tools/testing/selftests/mm/droppable.c | 46 +++++++++++++---------- 1 file changed, 26 insertions(+), 20 deletions(-)
tools/testing/selftests/mm/droppable.c renamed from tools/testing/selftests/mm/droppable.c~selftests-mm-fix-and-speedup-droppable-test +26 -20
@@ -17,10 +17,10 @@int main (int argc,char *argv[]) { -size_t alloc_size =134217728 ; -size_t page_size =getpagesize (); +const size_t alloc_size =2 *1024 *1024 ; +int retry_count =10 ; +bool dropped;void *alloc; -pid_t child;ksft_print_header ();ksft_set_plan (1 );
@@ -35,26 +35,32 @@ int main(int argc, char *argv[])exit (KSFT_FAIL ); }memset (alloc,'A' , alloc_size); -for (size_t i =0 ; i < alloc_size; i += page_size) -assert (*(uint8_t *)(alloc + i)); - child =fork (); -assert (child >=0 ); -if (!child) { -for (;;) - *(char *)malloc (page_size) ='B' ; - } - -for (bool done = false; !done;) { -for (size_t i =0 ; i < alloc_size; i += page_size) { -if (!*(uint8_t *)(alloc + i)) { - done = true; -break ; +while (retry_count--) { +if (madvise (alloc, alloc_size,MADV_PAGEOUT )) { +if (errno ==EINVAL ) { +ksft_test_result_skip ("madvise(MADV_PAGEOUT) not supported\n" ); +exit (KSFT_SKIP ); } +ksft_test_result_fail ("madvise(MADV_PAGEOUT) error: %s\n" ,strerror (errno)); +exit (KSFT_FAIL ); } + + dropped =memchr (alloc,'A' , alloc_size) ==NULL ; + +/* +* Speculative reference can temporarily prevent some +* pages from getting dropped. So sleep and retry. +* +* If a page is not droppable for 10s, something +* is seriously messed up and we want to fail. +*/ +if (dropped) +break ; +sleep (1 ); } -kill (child,SIGTERM ); -ksft_test_result_pass ("MAP_DROPPABLE: PASS\n" ); -exit (KSFT_PASS ); +ksft_test_result (dropped,"madvise(MADV_PAGEOUT) behavior\n" ); + +ksft_finished (); }
_
Patches currently in -mm which might be from [email protected] are