Re: [PATCH v6 01/39] mm/vma: fix mmap_prepare file handling, remove file_doesnt_need_get

From: Lorenzo Stoakes (ARM)

Date: Wed Oct 21 2026 - 10:42:52 EST


[ cut cc list for sanity ]

On Tue, Oct 20, 2026 at 05:47:04PM -0400, Gregory Price (Meta) wrote:
> On 2026-10-13 16:04 +0100, Lorenzo Stoakes (ARM) wrote:
> > The map->file_doesnt_need_get flag is confusing and the existing
> > implementation has holes.
> >
> > Drivers are permitted to change the owning file of a mapping. If they do
> > so, they are required to take a reference on that file.
> >
> > The mmap() operation which ultimately invokes __mmap_region() is guaranteed
> > to drop the refcount for the original file the mapping was made under, but
> > this is not true for the replaced file.
> >
> ...
> >
> > Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
>
> Have a nit below, but otherwise
>
> Reviewed-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>

Thanks! :)

>
> > +static bool map_same_file(struct mmap_state *map)
> > +{
> > + return map->vm_file == map->file;
> > +}
> >
>
> Terrible function name :]

I think let's leave things as-is and maybe chase this separately as a
follow-up ;)

--
Cheers, Lorenzo