On Fri, Apr 17, 2020 at 10:26 AM Brian Geffon <bgeffon@xxxxxxxxxx> wrote: > > However, MREMAP_DONTUNMAP leaves that original portion in place which > means that the VMA which was split and then remerged is not actually > split at the end of the mremap. I was waiting to hear others comment on this, but it's been very quiet. The patch looks correct to me, and the explanation is great. I'm inclined to just apply it. HOWEVER. I started looking at copy_vma(), and noticed that we seem to have exactly one caller: move_vma(). So I do have a query: would it perhaps not be a good idea to simply remove the "vma_merge()" call from copy_vma(), and do at the end of move_vma() instead? I don't hate this patch either, and I'll happily apply it if people prefer this one, but before doing that I thought I'd ask whether maybe instead of fixing up the mess made by vma_merge() that people didn't think about, maybe we should fix it at the underlying source of the problem? Are there any advantages to merging early? Shouldn't the basic principle be that we'd strive to always do the vma_merge() at the end of an operation that might have generated a mergable sequence of vma's? Linus