On Thu, Jun 11, 2026 at 12:01:55PM +0200, 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. Wow, thanks! I wish I had realized the MADV_PAGEOUT behavior while developing VM_DROPPABLE in the first place. That would have made development a lot easier. I wound up just running this in a memory limited VM to test out the different behaviors, which worked decent enough for verifying things. It would be interesting to me to now experiment with vgetrandom behavior over intentionally MADV_PAGEOUT'd droppable mappings, to fuzz that the careful bookchecking of that works as intended against droppable mappings. Anyway, thanks and:
Reviewed-by: Jason A. Donenfeld <[email protected]>

