[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuCfpFjhfEYzG2zBNnE0Spv1=DbamKTc46ie0U3r7QniOnqRA@mail.gmail.com>
Date: Mon, 15 Apr 2024 09:19:06 -0700
From: Suren Baghdasaryan <surenb@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Peter Xu <peterx@...hat.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>, Lokesh Gidra <lokeshgidra@...gle.com>,
Alistair Popple <apopple@...dia.com>
Subject: Re: [PATCH] mm: Always sanity check anon_vma first for per-vma locks
On Mon, Apr 15, 2024 at 9:13 AM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Mon, Apr 15, 2024 at 08:58:28AM -0700, Suren Baghdasaryan wrote:
> > On Fri, Apr 12, 2024 at 8:19 AM Matthew Wilcox <willy@...radeadorg> wrote:
> > >
> > > On Fri, Apr 12, 2024 at 09:53:29AM -0500, Suren Baghdasaryan wrote:
> > > > Unless vmf_anon_prepare() already explains why vma->anon_vma poses a
> > > > problem for per-vma locks, we should have an explanation there. This
> > > > comment would serve that purpose IMO.
> > >
> > > I'll do you one better; here's some nice kernel-doc for
> > > vmd_anon_prepare():
> >
> > I was looking at the find_tcp_vma(), which seems to be the only other
> > place where lock_vma_under_rcu() is currently used. I think it's used
> > there only for file-backed pages, so I don't think your change affects
> > that usecase but this makes me think that we should have some kind of
> > a warning for lock_vma_under_rcu() future users... Maybe your addition
> > of mmap_assert_locked() inside __anon_vma_prepare() is enough. Please
> > don't forget to include that assertion into your final patch.
>
> That's patch 1/3 on the git branch I pointed you to.
Ah, good!
>
> 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.
Powered by blists - more mailing lists