Re: [PATCH 1/1] mm/ksm: fix spurious soft-dirty bit on zero-filled page merging

From: David Hildenbrand

Date: Mon Sep 29 2025 - 04:25:09 EST


On 28.09.25 06:52, Lance Yang wrote:
From: Lance Yang <lance.yang@xxxxxxxxx>

When KSM merges a zero-filled page with the shared zeropage, it uses
pte_mkdirty() to mark the new PTE for internal accounting. However,
pte_mkdirty() unconditionally sets both the hardware dirty bit and the
soft-dirty bit.


Right, that's one think we should clean up at one point.

This behavior causes false positives in userspace tools like CRIU that
rely on the soft-dirty mechanism for tracking memory changes.

IIRC, false positives are not a problem. We get them all of the time when merging VMAs etc.

So I am not sure if this here is really worth fixing. Soft-dirty is not, and never will be false-positive free.

--
Cheers

David / dhildenb