Re: [PATCH v5 0/3] mm/ksm: fix ksm_zero_pages accounting on fork

From: David Hildenbrand

Date: Tue Dec 01 2026 - 07:47:14 EST


On Tue, 01 Dec 2026 15:45:24 +0800, xu.xin@xxxxxxxxx wrote:
> From: "Xu Xin (vivo)" <xu.xin@xxxxxxxxx>
>
> Currently, fork() wrongly inherits the parent's ksm_zero_pages counter
> and keeps the KSM dirty-bit marker on zero-page PTEs, inflating both the
> child's per-mm counter and the global ksm_zero_pages counter.
>
> Patch 1 fixes this by resetting the child's mm->ksm_zero_pages to 0 in
> ksm_fork() and clearing the KSM zero-page marker when copying present
> PTEs, and documents the behavior.
>
> [...]

Applied, thanks!

tree: mm/core.git
branch: ksm-7.5.misc

Applied patches will appear soon in mm-next, followed by linux-next.

Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.

It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.

[1/3] mm/ksm: do not inherit ksm_zero_pages counter or PTE markers on fork
https://git.kernel.org/mm/core/c/61da5a94
[2/3] selftests/mm: fix false-positive and racy KSM fork test
https://git.kernel.org/mm/core/c/1277a157
[3/3] selftests/mm: verify ksm_zero_pages is not inherited on fork
https://git.kernel.org/mm/core/c/56e0ea1b

--
Cheers,

David