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. 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.
A cleanup patch is added in the beginning to make later changes more
readable. The second patch contains most of the changes and the last
patch contains the changes associated with process_vma_walk_lock()
error handling.
Changes since v1 [1]:
- Moved vma_start_write_killable() inside set_mempolicy_home_node()
to be done before mpol_dup(new), per Jann Horn
- Added error propagation for the missing PGWALK_WRLOCK users and
split it into a separate patch, per Jann Horn
- Moved vma_start_write_killable() inside __split_vma() to be done
before new->vm_ops->open(), per Jann Horn
- Added a separate patch to change flow control in vma_expand(),
per Jann Horn
- Brought back signal_pending() in mm_take_all_locks, per Jann Horn
- Moved vma_start_write_killable() inside __mmap_new_vma() to be done
before __mmap_new_file_vma(), per Jann Horn
- Added Reviewed-by for powerpc, per Ritesh Harjani
- Added s390 reviewers and the list due to changes in the last patch
[1] https://lore.kernel.org/all/[email protected]/
Suren Baghdasaryan (3):
mm/vma: cleanup error handling path in vma_expand()
mm: replace vma_start_write() with vma_start_write_killable()
mm: use vma_start_write_killable() in process_vma_walk_lock()
arch/powerpc/kvm/book3s_hv_uvmem.c | 5 +-
arch/s390/kvm/kvm-s390.c | 5 +-
arch/s390/mm/gmap.c | 13 +++-
fs/proc/task_mmu.c | 7 +-
include/linux/mempolicy.h | 5 +-
mm/khugepaged.c | 5 +-
mm/madvise.c | 4 +-
mm/memory.c | 2 +
mm/mempolicy.c | 23 +++++--
mm/mlock.c | 20 ++++--
mm/mprotect.c | 4 +-
mm/mremap.c | 4 +-
mm/pagewalk.c | 20 ++++--
mm/vma.c | 105 ++++++++++++++++++++---------
mm/vma_exec.c | 6 +-
15 files changed, 164 insertions(+), 64 deletions(-)
base-commit: b08472d036a36893ecf68296d87beb58d21f4357
--
2.53.0.273.g2a3d683680-goog