Re: [PATCH RFC 0/3] mm/ksm: scan with per-VMA locks

From: xu.xin16

Date: Sun Sep 13 2026 - 00:37:50 EST


> From: Longlong Xia <xialonglong@xxxxxxxxxx>
>
> This work was developed independently before I saw the above series.
> After comparing the two implementations, I found that the approaches
> overlap, so I am posting this draft version as an alternative
> implementation and would be happy to combine the useful parts.
>
> The main differences are:
>
> - use per-VMA locking in the ksmd VMA scanner;
> - revalidate the mmap-lock sequence before skipping the fallback walk;
> - avoid repeating a completed VMA traversal when no candidate page is
> found.
>
> Benchmark (QEMU q35, TCG multi-thread, 4 vCPUs, 8 GiB, x86_64 guest on
> Ubuntu 24.04, 7.3-rc2 base, CONFIG_KSM=y + CONFIG_PER_VMA_LOCK=y;
> victim: 32 MiB anon, 2048 unique pages x4 duplicates,
> pages_to_scan=100000, sleep_millisecs=0, 3 runs each; churners: 4
> threads mmap/munmaping 256 MiB in the same mm. Microbenchmark as
> posted in [3]; relative numbers only, TCG is not native hardware):
>
> 0 churners 4 churners (mean)
> 7.3-rc2 1.21-1.41 s 90.9 s
> + patch 2/3 1.41 s 48.7 s (-46%)
> + patch 2/3 + 3/3 1.21-1.41 s 30.1 s (-67%)
>
>
> 1. mm/pagewalk: allow folio_walk_start() under a vma read lock
>
> 2. mm/ksm: use the VMA lock when looking up mergeable pages
>
> 3. mm/ksm: scan VMAs with per-VMA locks
>

it seems your patches may not be rebased on the latest mm-unstable or linux-next.
It might also be worth double-checking any AI-generated code before sending it out.

I also noticed that the content of patches 1 and 2 is already included in my patch series.
Perhaps it would be better to focus on my series for those and I'd appreciate your help
reviewing them. For patch 3, feel free to start a separate email thread if that works better.

Thanks