Re: [PATCH 0/2] make VM_SOFTDIRTY a sticky VMA flag
Andrei Vagin <[email protected]> Mon, 17 Nov 2025 10:26:34 -0800
| Newsgroups | dev.linux.lists.criu,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <CANaxB-zPuxtbpt7wcjDE1X5nv4yWp=JTq_MqWSfDce2gx-WKiA@mail.gmail.com> |
On Mon, Nov 17, 2025 at 3:33 AM Lorenzo Stoakes <[email protected]> wrote: > > On Sun, Nov 16, 2025 at 04:53:36PM -0800, Andrei Vagin wrote: > > On Fri, Nov 14, 2025 at 9:59 AM Lorenzo Stoakes > > <[email protected]> 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. > > > > Losing VM_SOFTDIRTY is definitely a bug, thank you for fixing it. > > > > A separate concern is whether merging two VMAs should be permitted when > > one has the VM_SOFTDIRTY flag set and another does not. I think the > > merging operation should be disallowed.The issue is that > > > This patch doesn't change anything in terms of merging, it only _correctly_ > marks VMAs as soft-dirty where certain, very specific, circumstances might > result in a merged VMA being incorrectly indicated to not be soft-dirty > when it in fact contains pages which are. As I mentioned in the previous message, this patch is correct, and I appreciate your effort to solve this issue. My comment was about whether we should allow merging VMAs if one has VM_SOFTDIRTY and the other does not. You are right, this is a separate question unrelated to this patch. I recall correctly that initially, merging vma-s with different VM_SORTDIRTY bit values was not allowed. It was a bit surprising that this behavior was changed by Cyrill in 34228d473efe. Cyrill was an active CRIU contributor at the time, so we can't even blame anyone for breaking CRIU :). Thanks, Andrei