Re: [PATCH mm-hotfixes] mm/rmap: clear vma->anon_vma on error
From: Lorenzo Stoakes (Oracle)
Date: Wed Mar 18 2026 - 10:25:08 EST
On Wed, Mar 18, 2026 at 02:38:18PM +0100, David Hildenbrand (Arm) wrote:
> On 3/18/26 14:03, Lorenzo Stoakes (Oracle) wrote:
> > On Wed, Mar 18, 2026 at 01:52:44PM +0100, David Hildenbrand (Arm) wrote:
> >>
> >> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> >>
> >
> > Thanks!
> >
> >> LGTM. I was wondering whether anon_vma_clone() should take care of
> >> setting up dst->anon_vma. It looks a bit odd in dup_anon_vma.
> >
> > Well in the fork case we don't want to set vma->anon_vma, as we use
> > vma->anon_vma to denote whether or not we reused another anon_vma. For
> > split + remap, we already duplicated it via vm_area_dup() ->
> > vm_area_init_from().
> >
> > But... now we have enum vma_operation threaded through here, we can just do
> > that there like:
> >
> > /* dst is unfaulted, so inherit src's anon_vma. */
> > if (operation == VMA_OP_MERGE_UNFAULTED)
> > dst->anon_vma = src->anon_vma;
> >
>
> Exactly what I had in mind.
That's fair, will send a separate patch for that!
>
> --
> Cheers,
>
> David
Cheers, Lorenzo