From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Suren Baghdasaryan <surenb@google.com>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Jann Horn <jannh@google.com>, Pedro Falcato <pfalcato@suse.de>,
Lance Yang <lance.yang@linux.dev>,
"David Hildenbrand (Arm)" <david@kernel.org>,
"Kiryl Shutsemau (Meta)" <kas@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Seunghyun An <san55@wisc.edu>
Subject: Re: [PATCH] mm/vma: predicate vma_assert_stabilised() on CONFIG_DEBUG_VM
Date: Tue, 10 Nov 2026 16:39:49 +0000 [thread overview]
Message-ID: <avNIEdpUbihHULcm@gremlin> (raw)
In-Reply-To: <avNDjxZ9jeYiwdVh@gremlin>
On Tue, Nov 10, 2026 at 04:18:35PM +0000, Lorenzo Stoakes (ARM) wrote:
> On Tue, Nov 10, 2026 at 04:07:48PM +0000, Lorenzo Stoakes (ARM) wrote:
> > Andrew - could you update as below?
> >
> > Thanks!
> >
> > On Tue, Nov 10, 2026 at 03:10:40PM +0000, Lorenzo Stoakes (ARM) wrote:
> > [ ... ]
> > > diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
> > > index 9ccbbcbd7aca..9c3a9c6525c1 100644
> > > --- a/include/linux/mmap_lock.h
> > > +++ b/include/linux/mmap_lock.h
> > [ ... ]
> > > /**
> > > * vma_assert_stabilised() - assert that this VMA cannot be changed from
> > > * underneath us either by having a VMA or mmap lock held.
> > > @@ -418,9 +423,18 @@ static inline void vma_assert_locked(const struct vm_area_struct *vma)
> > > *
> > > * With lockdep disabled we may sometimes race with other threads acquiring the
> > > * mmap read lock simultaneous with our VMA read lock.
> > > + *
> > > + * Assert only if CONFIG_DEBUG_VM is set.
>
> Also this should say:
>
> 'Assert only if CONFIG_DEBUG_VM or CONFIG_LOCKDEP is set.'
>
> > > */
> > > static inline void vma_assert_stabilised(const struct vm_area_struct *vma)
> > > {
> > > + if (!IS_ENABLED(CONFIG_DEBUG_VM))
> >
> > Actually I think this should be:
> >
> > if (!IS_ENABLED(CONFIG_DEBUG_VM) || !IS_ENABLED(CONFIG_LOCKDEP))
>
> Sorry this should be...
>
> if (!IS_ENABLED(CONFIG_DEBUG_VM) && !IS_ENABLED(CONFIG_LOCKDEP))
>
> (I have a bit of a fever today, can you tell? :P)
>
> Thanks!
OK OK actually. Sorry. The change isn't required, it's fine :P
Please leave the patch as it is.
If !CONFIG_DEBUG_VM but CONFIG_LOCKDEP we don't actually assert anything.
Since this:
if (IS_ENABLED(CONFIG_LOCKDEP)) {
if (lockdep_is_held(&vma->vm_mm->mmap_lock))
return;
}
Is the only thing that would run in the functino and early-exit if the condition
is hit.
Then it defers to vma_assert_locked() which then reaches:
if (IS_ENABLED(CONFIG_LOCKDEP)) {
if (!lock_is_held(__vma_lockdep_map(vma)))
vma_assert_write_locked(vma);
return;
}
And vma_assert_write_locked() uses VM_WARN_ON_ONCE_VMA().
(flu vaccine on sunday, seems to have impacted my brain :P)
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-11-10 16:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 15:10 [PATCH] mm/vma: predicate vma_assert_stabilised() on CONFIG_DEBUG_VM Lorenzo Stoakes (ARM)
2026-11-10 15:18 ` Suren Baghdasaryan
2026-11-10 15:23 ` Liam R. Howlett
2026-11-10 15:37 ` Pedro Falcato
2026-11-10 16:07 ` Lorenzo Stoakes (ARM)
2026-11-10 16:18 ` Lorenzo Stoakes (ARM)
2026-11-10 16:39 ` Lorenzo Stoakes (ARM) [this message]
2026-11-10 17:32 ` Seunghyun An
2026-11-10 17:37 ` Lorenzo Stoakes (ARM)
2026-11-10 18:03 ` Seunghyun An
2026-11-10 18:07 ` Pedro Falcato
2026-11-11 9:31 ` Vlastimil Babka (SUSE)
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=avNIEdpUbihHULcm@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pfalcato@suse.de \
--cc=san55@wisc.edu \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.