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>
Cc: ljs@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] mm: only assert mmap and VMA locks if CONFIG_DEBUG_VM is set
Date: Tue, 10 Nov 2026 16:57:42 +0000 [thread overview]
Message-ID: <20261110-tame-vma-asserts-v1-0-be293ff499a7@kernel.org> (raw)
Currently these asserts are all performed at runtime regardless of whether
or not the kernel is intended for debugging mm code (i.e. whether or not
CONFIG_DEBUG_VM is set).
These are explicitly programmatic checks - that is, checking basic
correctness in mm code which interacts with these locks.
The problem with this is that checks like this are generally asserted in mm
code using VM_WARN_ON_ONCE() and similar, and thus only checked if
CONFIG_DEBUG_VM is set.
So having some assertions which are unconditional and some not without it
being clear, creates something of an unintended two-tier system.
Since what is being asserted in these cases is exactly the same kind of
condition as those asserted in VM_WARN_ON_ONCE() assertions, simply
predicate them on CONFIG_DEBUG_VM.
Retain assertions for mmap lock asserts if CONFIG_LOCKDEP is specified in
order that expected lockdep assertions continue to function.
The VMA lock implementation already performs lockdep tracking regardless of
whether CONFIG_DEBUG_VM is set or not, so no changes are required there.
---
Note that this series assumes [0] has landed and builds on it. That patch
is the uncontroversial bit, this series contains the bits that are slightly
more controversial (but not really :)
[0]: https://lore.kernel.org/linux-mm/20261110-vma-fixup-debug-asserts-v1-1-0b2e0680cd7e@kernel.org/
To: Andrew Morton <akpm@linux-foundation.org>
To: Suren Baghdasaryan <surenb@google.com>
To: Liam R. Howlett <liam@infradead.org>
To: Vlastimil Babka <vbabka@kernel.org>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
Lorenzo Stoakes (ARM) (3):
mm: only assert mmap locks if CONFIG_DEBUG_VM or lockdep is set
mm: only assert VMA locks if CONFIG_DEBUG_VM is set
mm: convert WARN_ON_ONCE()'s to VM_WARN_ON_ONCE() in VMA lock code
include/linux/mmap_lock.h | 23 +++++++++++++++++++----
mm/mmap_lock.c | 6 +++---
2 files changed, 22 insertions(+), 7 deletions(-)
---
base-commit: b82f7651c53524960fe38a54aa69677dcddff655
change-id: 20261110-tame-vma-asserts-480acf6aee20
Cheers,
--
Lorenzo Stoakes (ARM) <ljs@kernel.org>
next reply other threads:[~2026-11-10 16:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 16:57 Lorenzo Stoakes (ARM) [this message]
2026-11-10 16:57 ` [PATCH 1/3] mm: only assert mmap locks if CONFIG_DEBUG_VM or lockdep " Lorenzo Stoakes (ARM)
2026-11-10 16:57 ` [PATCH 2/3] mm: only assert VMA locks if CONFIG_DEBUG_VM " Lorenzo Stoakes (ARM)
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)
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=20261110-tame-vma-asserts-v1-0-be293ff499a7@kernel.org \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®