From: sashiko-bot@kernel.org
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
"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>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH 2/3] mm: only assert VMA locks if CONFIG_DEBUG_VM is set
Date: Wed, 11 Nov 2026 17:01:41 +0000 [thread overview]
Message-ID: <sashiko-outbox-209359@kernel.org> (raw)
In-Reply-To: <20261110-tame-vma-asserts-v1-2-be293ff499a7@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm: missing CONFIG_DEBUG_VM guard in vma_assert_stabilised()
--
commit f772b5a674b87f589a1f2a31923e1ad5204e14f7
Author: Lorenzo Stoakes (ARM) <ljs@kernel.org>
mm: only assert VMA locks if CONFIG_DEBUG_VM is set
This commit gates VMA lock and attachment assertions on CONFIG_DEBUG_VM so
that they do not run in non-debug builds.
> diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
> index 7b6749e0f6fa6..d0291e6a4d20d 100644
> --- a/include/linux/mmap_lock.h
> +++ b/include/linux/mmap_lock.h
[ ... ]
> @@ -369,11 +374,16 @@ static inline void vma_assert_write_locked(const struct vm_area_struct *vma)
> * vma_assert_locked() - assert that @vma holds either a VMA read or a VMA write
> * lock and is not detached.
> * @vma: The VMA to assert.
> + *
> + * Assert only if CONFIG_DEBUG_VM is set.
> */
> static inline void vma_assert_locked(const struct vm_area_struct *vma)
> {
> unsigned int refcnt;
>
> + if (!IS_ENABLED(CONFIG_DEBUG_VM))
> + return;
> +
> if (!IS_ENABLED(CONFIG_MMU)) {
> mmap_assert_locked(vma->vm_mm);
> return;
[Severity: Low]
Should vma_assert_stabilised() also return early when
!IS_ENABLED(CONFIG_DEBUG_VM), just like vma_assert_can_modify() below?
Because its tail call to vma_assert_locked() is now a no-op when
CONFIG_DEBUG_VM is disabled, vma_assert_stabilised() can no longer assert
anything in !CONFIG_DEBUG_VM builds, but it still runs lockdep_is_held()
or the volatile atomic_long_read() in rwsem_is_locked(&vma->vm_mm->mmap_lock)
(and vma_has_anon_rmap() still runs the volatile refcount_read() in
vma_is_attached(vma) before calling it):
include/linux/mmap_lock.h:vma_assert_stabilised() {
...
if (IS_ENABLED(CONFIG_LOCKDEP)) {
if (lockdep_is_held(&vma->vm_mm->mmap_lock))
return;
} else {
if (rwsem_is_locked(&vma->vm_mm->mmap_lock))
return;
}
vma_assert_locked(vma);
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-tame-vma-asserts-v1-0-be293ff499a7@kernel.org?part=2
next prev parent reply other threads:[~2026-11-11 17:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 16:57 [PATCH 0/3] mm: only assert mmap and VMA locks if CONFIG_DEBUG_VM is set Lorenzo Stoakes (ARM)
2026-11-10 16:57 ` [PATCH 1/3] mm: only assert mmap locks if CONFIG_DEBUG_VM or lockdep " Lorenzo Stoakes (ARM)
2026-11-11 1:23 ` Liam R. Howlett
2026-11-11 9:35 ` Vlastimil Babka (SUSE)
2026-11-10 16:57 ` [PATCH 2/3] mm: only assert VMA locks if CONFIG_DEBUG_VM " Lorenzo Stoakes (ARM)
2026-11-11 1:29 ` Liam R. Howlett
2026-11-11 9:38 ` Vlastimil Babka (SUSE)
2026-11-11 17:01 ` sashiko-bot [this message]
2026-11-10 16:57 ` [PATCH 3/3] mm: convert WARN_ON_ONCE()'s to VM_WARN_ON_ONCE() in VMA lock code Lorenzo Stoakes (ARM)
2026-11-11 1:30 ` Liam R. Howlett
2026-11-11 9:38 ` 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=sashiko-outbox-209359@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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.