Skip to content

Use killable vma write locking in most places

Suren Baghdasaryan kvm linux-mm linux-s390 linuxppc-dev lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest6 patches 16 repliesIn review
  2. v56 patches 12 repliesSuperseded
  3. v44 patches 11 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v33 patches23 repliesSuperseded
v23 patches10 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6mm/vma: cleanup error handling path in vma_expand()mm/vma.c+11 -70 replies
2/6mm: use vma_start_write_killable() in mm syscallsmm/madvise.c mm/memory.c mm/mempolicy.c +4 more+86 -278 replies
3/6mm/khugepaged: use vma_start_write_killable() in collapse_huge_page()mm/khugepaged.c+4 -10 replies
4/6mm/vma: use vma_start_write_killable() in vma operationsmm/vma.c mm/vma_exec.c+117 -352 replies
5/6mm: use vma_start_write_killable() in process_vma_walk_lock()fs/proc/task_mmu.c mm/mempolicy.c mm/pagewalk.c+30 -142 replies
6/6KVM: PPC: use vma_start_write_killable() in kvmppc_memslot_page_merge()arch/powerpc/kvm/book3s_hv_uvmem.c+4 -10 replies

Reviews trailers per patch

3 of 6 patches have a Reviewed-by or Acked-by.

PatchLiam R. HowlettLorenzo StoakesBarry SongLorenzo Stoakes (Oracle)Ritesh Harjani (IBM)
1/6R-b R-b R-b
2/6
3/6R-b
4/6
5/6
6/6R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v6 thread

Cover letter [PATCH v6 0/6] Use killable vma write locking in most places

Now that we have vma_start_write_killable() we can replace most of the vma_start_write() calls with it, improving reaction time to the kill signal.

There are several places which are left untouched by this patchset:

1. free_pgtables() because function should free page tables even if a fatal signal is pending.

2. userfaultd code, where some paths calling vma_start_write() can handle EINTR and some can't without a deeper code refactoring.

3. mpol_rebind_mm() which is used by cpusset controller for migrations and operates on a remote mm. Incomplete operations here would result in an inconsistent cgroup state.

4. vm_flags_{set|mod|clear} require refactoring that involves moving vma_start_write() out of these functions and replacing it with vma_assert_write_locked(), then callers of these functions should lock the vma themselves using vma_start_write_killable() whenever possible.

Changes since v5 [1]:
- Added Reviewed-by for unchanged patches, per Lorenzo Stoakes

Patch#2:
- Fixed locked_vm counter if mlock_vma_pages_range() fails in mlock_fixup(), per Sashiko
- Avoid VMA re-locking in madvise_update_vma(), mprotect_fixup() and mseal_apply() when vma_modify_XXX creates a new VMA as it will already be locked. This prevents the possibility of incomplete operation if signal happens after a successful vma_modify_XXX modified the vma tree, per Sashiko
- Removed obsolete comment in madvise_update_vma() and mprotect_fixup()

Patch#4:
- Added clarifying comment for vma_start_write_killable() when locking a detached VMA
- Override VMA_MERGE_NOMERGE in vma_expand() to prevent callers from falling back to a new VMA allocation, per Sashiko
- Added a note in the changelog about temporary workaround of using ENOMEM to propagate the error in vma_merge_existing_range() and vma_expand()

Patch#5:
- Added fatal_signal_pending() check in do_mbind() to detect queue_pages_range() failures due to a pendig fatal signal, per Sashiko

[1] https://lore.kernel.org/all/[email protected]/

Suren Baghdasaryan (6):
mm/vma: cleanup error handling path in vma_expand()
mm: use vma_start_write_killable() in mm syscalls mm/khugepaged: use vma_start_write_killable() in collapse_huge_page() mm/vma: use vma_start_write_killable() in vma operations
mm: use vma_start_write_killable() in process_vma_walk_lock()
KVM: PPC: use vma_start_write_killable() in
kvmppc_memslot_page_merge()

 arch/powerpc/kvm/book3s_hv_uvmem.c |   5 +-
 fs/proc/task_mmu.c                 |  12 +--
 mm/khugepaged.c                    |   5 +-
 mm/madvise.c                       |  13 ++-
 mm/memory.c                        |   2 +
 mm/mempolicy.c                     |  21 +++-
 mm/mlock.c                         |  30 ++++--
 mm/mprotect.c                      |  25 +++--
 mm/mremap.c                        |   8 +-
 mm/mseal.c                         |  24 ++++-
 mm/pagewalk.c                      |  22 ++--
 mm/vma.c                           | 162 ++++++++++++++++++++++-------
 mm/vma_exec.c                      |   6 +-
 13 files changed, 251 insertions(+), 84 deletions(-)

base-commit: e53c9040ab1b738dd2c83b57558f141902caaf4f

Signature · 1 line
2.53.0.1018.g2bb0e51243-goog