linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm: perform guard region install/remove under VMA lock
@ 2025-11-10 17:22 Lorenzo Stoakes
  2025-11-10 17:22 ` [PATCH v2 1/2] mm: rename walk_page_range_mm() Lorenzo Stoakes
  2025-11-10 17:22 ` [PATCH v2 2/2] mm/madvise: allow guard page install/remove under VMA lock Lorenzo Stoakes
  0 siblings, 2 replies; 9+ messages in thread
From: Lorenzo Stoakes @ 2025-11-10 17:22 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Hildenbrand, Liam R . Howlett, Vlastimil Babka,
	Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jann Horn,
	linux-mm, linux-kernel

There is no reason why can't perform guard region operations under the VMA
lock, as long we take proper precautions to ensure that we do so in a safe
manner.

This is fine, as VMA lock acquisition is always best-effort, so if we are
unable to do so, we can simply fall back to using the mmap read lock.

Doing so will reduce mmap lock contention for callers performing guard
region operations and help establish a precedent of trying to use the VMA
lock where possible.

As part of this change we perform a trivial rename of page walk functions
which bypass safety checks (i.e. whether or not mm_walk_ops->install_pte is
specified) in order that we can keep naming consistent with the mm walk.

This is because we need to expose a VMA-specific walk that still allows us
to install PTE entries.


v2:
* Rename check_ops_valid() to check_ops_safe() as per David.
* Renamed is_vma_lock_valid() to is_vma_lock_sufficient() as per David.

v1:
https://lore.kernel.org/all/cover.1762686301.git.lorenzo.stoakes@oracle.com/

Lorenzo Stoakes (2):
  mm: rename walk_page_range_mm()
  mm/madvise: allow guard page install/remove under VMA lock

 mm/internal.h |   5 ++-
 mm/madvise.c  | 110 ++++++++++++++++++++++++++++++++++++--------------
 mm/pagewalk.c |  37 ++++++++++-------
 3 files changed, 105 insertions(+), 47 deletions(-)

--
2.51.0


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

end of thread, other threads:[~2025-11-11 17:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-10 17:22 [PATCH v2 0/2] mm: perform guard region install/remove under VMA lock Lorenzo Stoakes
2025-11-10 17:22 ` [PATCH v2 1/2] mm: rename walk_page_range_mm() Lorenzo Stoakes
2025-11-10 18:27   ` David Hildenbrand (Red Hat)
2025-11-11  7:56   ` Vlastimil Babka
2025-11-11 17:12   ` Davidlohr Bueso
2025-11-10 17:22 ` [PATCH v2 2/2] mm/madvise: allow guard page install/remove under VMA lock Lorenzo Stoakes
2025-11-10 18:29   ` David Hildenbrand (Red Hat)
2025-11-11  8:12   ` Vlastimil Babka
2025-11-11 17:26   ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox