Re: [PATCH v3 4/4] selftests/mm: cover merging KSM pages aged by smart scan

From: David Hildenbrand (Arm)

Date: Sat Nov 07 2026 - 14:54:29 EST


On 11/7/26 17:57, Qiliang Yuan wrote:
> ksm_functional_tests checks merging and unmerging with ksmd's default
> settings, but nothing there exercises smart scan, which skips pages KSM
> has failed to merge for a while.
>
> Smart scan used to time those skips per page, so two identical pages
> that became mergeable some scans apart could end up never being looked
> at in the same scan, and were never merged. "mm/ksm: align smart scan
> skips with the scan number" fixed that.
>
> Add ksm_get_smart_scan() and ksm_set_smart_scan() to vm_util, and a
> case that enables smart scan, lets sixteen unique pages age for a dozen
> scans, then makes a duplicate of each mergeable one scan apart, and
> expects every pair to be merged 32 scans later:
>
> kernel failures, two boots
> before the fix 20/20, 20/20
> with the fix 0/20, 0/20
>
> Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
> ---

Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David