Re: ksm: add mremap selftests for ksm_rmap_walk
From: David Hildenbrand (Arm)
Date: Wed Apr 08 2026 - 09:20:23 EST
>
> Oh, thanks to David and Hugh's reminder, I now understand the issue Hugh was pointing out, and I also
> see why my current test program incorrectly passes: before migrating the memory page, the
> mremap() operation has already turned a KSM page into an anonymous page, causing the code to
> take rmap_walk_anon instead of rmap_walk_ksm. Therefore, to reproduce the issue Hugh described,
> we only need to add a delay of wait_ksmd_scan_finish_two_truns before migration (after mremap)
>
> — simply wait for ksmd to merge the remapped page back into a KSM page.
>
> such testing code can reproduce what Hugh points out and FAIL to migrate:
>
Cool, please update the test to take that into account, and please also
test with child processes involved (no mremap() in child, only mremap()
before merging in the host).
--
Cheers,
David