Re: [PATCH] selftests: mm: fix and speedup "droppable" test
From: David Hildenbrand (Arm)
Date: Thu Jun 11 2026 - 07:27:13 EST
On 6/11/26 13:07, Sarthak Sharma wrote:
>
>
> On 6/11/26 3:31 PM, David Hildenbrand (Arm) wrote:
>> 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
>>
>> Reported-by: Aishwarya TCV <Aishwarya.TCV@xxxxxxx>
>> Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")
>> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>> ---
>
> I ran this test before and after applying the patch and recorded the
> execution time over 5 runs on an Orion O6 board.
>
Thanks!
> Before the patch, average execution time = 3.87 s
Out of interest, how much memory did your machine have?
I ran into this myself on a 200gig machine, and there was essentially no
progress ...
--
Cheers,
David