From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
Jann Horn <jannh@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] add and use vma_assert_stabilised() helper
Date: Fri, 16 Jan 2026 10:27:46 +0000 [thread overview]
Message-ID: <cover.1768558900.git.lorenzo.stoakes@oracle.com> (raw)
Sometimes we wish to assert that a VMA is stable, that is - the VMA cannot
be changed underneath us. This will be the case if EITHER the VMA lock or
the mmap lock is held.
We already open-code this in two places - anon_vma_name() in mm/madvise.c
and vma_flag_set_atomic() in include/linux/mm.h.
This series adds a number of pre-requisite predicates and adds
vma_assert_stablisied() which can be used in these callsites instead.
However the asserts implemented there subtly wrong - if CONFIG_PER_VMA_LOCK
is not implemented and the mmap lock is not held, then we don't actually
assert anything.
Since this is an assert that only fires when CONFIG_DEBUG_VM is set and the
test bots will largely be running with CONFIG_PER_VMA_LOCK set, this is
likely in practice not a real-world issue.
In any case, this series additionally fixes this issue.
As part of this change we also reduce duplication of code in VMA lock
asserts.
This change also lays the foundation for future series to add this assert
in further appropriate places to account for us now living in a world where
a VMA may be stablised by either lock.
Lorenzo Stoakes (2):
mm/vma: add vma_is_*_locked() helpers
mm: add + use vma_is_stabilised(), vma_assert_stabilised() helpers
include/linux/mm.h | 4 +--
include/linux/mmap_lock.h | 55 +++++++++++++++++++++++++++++++++------
mm/madvise.c | 4 +--
3 files changed, 49 insertions(+), 14 deletions(-)
--
2.52.0
next reply other threads:[~2026-01-16 10:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 10:27 Lorenzo Stoakes [this message]
2026-01-16 10:27 ` [PATCH 1/2] mm/vma: add vma_is_*_locked() helpers Lorenzo Stoakes
2026-01-16 10:27 ` [PATCH 2/2] mm: add + use vma_is_stabilised(), vma_assert_stabilised() helpers Lorenzo Stoakes
2026-01-16 10:33 ` Lorenzo Stoakes
2026-01-16 10:46 ` [PATCH 0/2] add and use vma_assert_stabilised() helper Lorenzo Stoakes
2026-01-16 13:51 ` [syzbot ci] " syzbot ci
2026-01-16 14:03 ` Lorenzo Stoakes
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=cover.1768558900.git.lorenzo.stoakes@oracle.com \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/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