[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1768558900.git.lorenzo.stoakes@oracle.com>
Date: Fri, 16 Jan 2026 10:27:46 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: David Hildenbrand <david@...nel.org>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
Shakeel Butt <shakeel.butt@...ux.dev>, Jann Horn <jannh@...gle.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [PATCH 0/2] add and use vma_assert_stabilised() helper
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
Powered by blists - more mailing lists