Re: [PATCH 0/3] mm: fix soft-dirty false positives in mprotect() of large folios

From: David Hildenbrand (Arm)

Date: Wed Nov 25 2026 - 08:43:45 EST


On 11/25/26 14:32, Shivank Garg wrote:
> mprotect() handles the PTEs of a large folio as one batch, and marks the
> whole batch dirty with pte_mkdirty() if any of its PTEs is dirty. On
> x86, powerpc, riscv and s390, pte_mkdirty() also sets the soft-dirty
> bit, so after clear_refs, mprotect() marks unwritten pages soft-dirty.
> With 64K mTHP on x86-64, all 240 unwritten pages of a 1MiB region are
> reported soft-dirty; with my fix, none are.

Why do we care? Just over-indicate soft-dirty. It's valid, and the whole feature
is full of holes and buggy as hell.

--
Cheers,

David