Re: [PATCH 0/2] make VM_SOFTDIRTY a sticky VMA flag

From: Lorenzo Stoakes

Date: Mon Nov 17 2025 - 06:46:19 EST


On Fri, Nov 14, 2025 at 01:53:03PM -0800, Andrew Morton wrote:
> On Fri, 14 Nov 2025 17:53:17 +0000 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.
> >
>
> userspace-visible effects?

Simply more correct accounting of soft-dirty :)

>
> Documentation/admin-guide/mm/soft-dirty.rst tells me that this can
> already happen in other circumstances so I guess it isn't very serious.
> CRIU inefficiency. perhaps?

I don't think it should cause inefficiency other than us already _accidentally_
being more efficient, see the discussion in thread :)

>
> Please review Documentation/admin-guide/mm/soft-dirty.rst, check that
> it is complete and accurate?

It LGTM, we are changing some very specific internal implementation detail here
which I don't think is worth mentioning here (effectively - 'we used to be wrong
sometimes, now not so much' :)

(Staring at tihs I realise I _probably_ need to change something very specific
in the original sticky implementation. The VMA implementation is so
finnicky... will send follow up fixpatch/respin on that w/details)

Cheers, Lorenzo