Re: [PATCH v4 3/9] mm: update vma_modify_flags() to handle residual flags, document
From: Vlastimil Babka
Date: Wed Nov 19 2025 - 11:28:00 EST
On 11/18/25 11:17, Lorenzo Stoakes wrote:
> The vma_modify_*() family of functions each either perform splits, a merge
> or no changes at all in preparation for the requested modification to
> occur.
>
> When doing so for a VMA flags change, we currently don't account for any
> flags which may remain (for instance, VM_SOFTDIRTY) despite the requested
> change in the case that a merge succeeded.
>
> This is made more important by subsequent patches which will introduce the
> concept of sticky VMA flags which rely on this behaviour.
>
> This patch fixes this by passing the VMA flags parameter as a pointer and
> updating it accordingly on merge and updating callers to accommodate for
> this.
>
> Additionally, while we are here, we add kdocs for each of the
> vma_modify_*() functions, as the fact that the requested modification is
> not performed is confusing so it is useful to make this abundantly
> clear.
>
> We also update the VMA userland tests to account for this change.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
LGTM (where the "good" means "correct" (*), not "nice", which is however not
a fault of the patch but the pre-existing code :)
Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
(*) but it's likely there will be a fix needed, whenever I conclude this