Re: [PATCH] mm: Always sanity check anon_vma first for per-vma locks

From: Matthew Wilcox
Date: Mon Apr 15 2024 - 12:27:03 EST


On Mon, Apr 15, 2024 at 09:19:06AM -0700, Suren Baghdasaryan wrote:
> On Mon, Apr 15, 2024 at 9:13 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> > The tcp vma is not file backed, but I'm pretty sure that COW is not
> > something they want, so there's never an anon_vma. It's for pages
> > that contain received TCP packets; ie it's mmaped TCP.
>
> I was following
> tcp_zerocopy_receive()->tcp_zerocopy_vm_insert_batch()->vm_insert_pages()->insert_page_in_batch_locked()->validate_page_before_insert()
> which errors out for PageAnon(page). So, I assumed this path works on
> file-backed pages but I'm not familiar with this code at all.

It turns out there are pages which are neither file nor anon ;-)
I have a partial list here:

https://kernelnewbies.org/MatthewWilcox/Memdescs

but I don't even have TCP on that list. I haven't looked into what they
need -- I don't think they need mapping, index, etc, but I need to
figure that out.