Re: [PATCH v2 1/2] mm: propagate VM_SOFTDIRTY on merge
From: Lorenzo Stoakes
Date: Wed Nov 19 2025 - 12:22:10 EST
On Mon, Nov 17, 2025 at 09:52:52AM -0800, Andrei Vagin wrote:
> On Mon, Nov 17, 2025 at 9:40 AM Lorenzo Stoakes
> <lorenzo.stoakes@xxxxxxxxxx> wrote:
> >
> > Currently we set VM_SOFTDIRTY when a new mapping is set up (whether by
> > establishing a new VMA, or via merge) as implemented in __mmap_complete()
> > and do_brk_flags().
> >
> > However, when performing a merge of existing mappings such as when
> > performing mprotect(), we may lose the VM_SOFTDIRTY flag.
> >
> > This is because currently we simply ignore VM_SOFTDIRTY for the purposes
> > of merge, so one VMA may possess the flag and another not, and whichever
> > happens to be the target VMA will be the one upon which the merge is
> > performed which may or may not have VM_SOFTDIRTY set.
> >
> > Now we have the concept of 'sticky' VMA flags, let's make VM_SOFTDIRTY one
> > which solves this issue.
> >
> > Additionally update VMA userland tests to propagate changes.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> > Suggested-by: Vlastimil Babka <vbabka@xxxxxxx>
> > Acked-by: David Hildenbrand (Red Hat) <david@xxxxxxxxxx>
> > Reviewed-by: Pedro Falcato <pfalcato@xxxxxxx>
>
> Acked-by: Andrey Vagin <avagin@xxxxxxxxx>
Thanks :)
>
> Thanks,
> Andrei