From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
akpm@linux-foundation.org, dave.hansen@linux.intel.com,
Liam.Howlett@oracle.com, david@kernel.org,
shakeel.butt@linux.dev, vbabka@kernel.org, jannh@google.com,
aliceryhl@google.com, arve@android.com, cmllamas@google.com,
christian@brauner.io, tkjos@android.com, dsahern@kernel.org,
davem@davemloft.net, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
netdev@vger.kernel.org
Subject: Re: [PATCH v4 1/5] mm: Make per-VMA locks available universally
Date: Mon, 10 Aug 2026 10:42:50 +0100 [thread overview]
Message-ID: <anmcwYilggkd_-B5@lucifer> (raw)
In-Reply-To: <anmQIeQIGkZdCKVU@lucifer>
On Mon, Aug 10, 2026 at 09:52:11AM +0100, Lorenzo Stoakes (ARM) wrote:
> On Sat, Aug 08, 2026 at 02:12:50AM +0100, Matthew Wilcox wrote:
> > On Thu, Aug 06, 2026 at 01:05:44PM -0700, Suren Baghdasaryan wrote:
> > > +++ b/kernel/bpf/stackmap.c
> > > @@ -272,13 +272,8 @@ struct stack_map_vma_lock {
> > > /*
> > > * Acquire a stable read-side reference on the VMA covering @ip.
> > > *
> > > - * With CONFIG_PER_VMA_LOCK=y this returns a VMA with its per-VMA read
> > > - * lock held and mmap_lock dropped, so the caller may sleep.
> > > - *
> > > - * With CONFIG_PER_VMA_LOCK=n it returns a VMA with mmap_lock still
> > > - * held; the caller must snapshot any fields it needs and pin vm_file
> > > - * with get_file() before stack_map_unlock_vma() drops mmap_lock, as
> > > - * the VMA may be split, merged, or freed after that.
> > > + * This returns a VMA with its per-VMA read lock held and mmap_lock
> > > + * dropped, so the caller may sleep.
> >
> > I don't know if BPF is compatible with !MMU or not, but the comment
> > is inconsistent with the code. How about:
>
> <requisite nommu rant>
>
> I do think there are components that simply don't think to depend on CONFIG_MMU
> even though they do.
>
> In fact more than think - have run into exactly that before.
>
> It's another thing that speaks to nommu being a legacy barnacle that bashes us
> on the head fairly regularly for little to no gain (and nobody is testing it for
> tip kernel AFAICT).
>
> </requisite nommu rant>
>
> >
> > * On NOMMU configurations, returns with the mmap_lock held. If the MMU
> > * is enabled, the per-VMA lock will be held instead. The lock
> > * should be released with stack_map_unlock_vma() which will release the
> > * appropriate lock. Once the lock is released, the VMA may be freed.
>
> I mean I suppose it's accurate but I don't love the idea of essentially implying
> nommu+bpf is a thing and also treating it as so important that it must be called
> out here.
>
> I'd rather it be inaccurate for nommu as are most comments in mm and mm-adjacent
> components, it's kinda implied in general. Those who care can look at the code.
Actually scratch that I'm wrong, firstly Suren's series explicitly does some
nommu-specific logic in the bpf code and secondly BPF already has nommu-specific
stuff in it.
It seems nommu bpf is (kinda) a supported path.
>
> >
> > > * Returns NULL on failure, in which case no lock is held.
> > > */
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-08-10 9:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 20:05 [PATCH v4 0/5] mm: Unconditional per-VMA locks and cleanups Suren Baghdasaryan
2026-08-06 20:05 ` [PATCH v4 1/5] mm: Make per-VMA locks available universally Suren Baghdasaryan
2026-08-07 15:37 ` Vlastimil Babka (SUSE)
2026-08-08 1:12 ` Matthew Wilcox
2026-08-08 6:08 ` Suren Baghdasaryan
2026-08-10 8:52 ` Lorenzo Stoakes (ARM)
2026-08-10 9:42 ` Lorenzo Stoakes (ARM) [this message]
2026-08-10 10:17 ` Lorenzo Stoakes (ARM)
2026-08-06 20:05 ` [PATCH v4 2/5] binder: Make shrinker rely solely on per-VMA lock Suren Baghdasaryan
2026-08-07 14:26 ` Alice Ryhl
2026-08-10 10:22 ` Lorenzo Stoakes (ARM)
2026-08-06 20:05 ` [PATCH v4 3/5] mm: Add RCU-based VMA lookup helper that waits for writers Suren Baghdasaryan
2026-08-07 15:39 ` Vlastimil Babka (SUSE)
2026-08-08 7:24 ` Matthew Wilcox
2026-08-09 1:07 ` Suren Baghdasaryan
2026-08-10 10:24 ` Lorenzo Stoakes (ARM)
2026-08-08 7:37 ` Matthew Wilcox
2026-08-10 10:41 ` Lorenzo Stoakes (ARM)
2026-08-06 20:05 ` [PATCH v4 4/5] binder: Remove mmap_lock fallback Suren Baghdasaryan
2026-08-06 20:05 ` [PATCH v4 5/5] tcp: Remove mmap_lock fallback path Suren Baghdasaryan
2026-08-08 7:26 ` Matthew Wilcox
2026-08-09 0:51 ` Suren Baghdasaryan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anmcwYilggkd_-B5@lucifer \
--to=ljs@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=cmllamas@google.com \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=david@kernel.org \
--cc=dsahern@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=tkjos@android.com \
--cc=vbabka@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox