mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] mm: only assert mmap and VMA locks if CONFIG_DEBUG_VM is set
@ 2026-11-10 16:57 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)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-10 16:57 UTC (permalink / raw)
  To: Andrew Morton, Suren Baghdasaryan, Liam R. Howlett,
	Vlastimil Babka, Shakeel Butt
  Cc: ljs, linux-mm, linux-kernel

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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-10 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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-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)

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®