[PATCH v3 11/11] s390/mm: Convert to LOCK_MM_AND_FIND_VMA

From: Claudio Imbrenda
Date: Tue Oct 15 2024 - 12:46:00 EST


From: Heiko Carstens <hca@xxxxxxxxxxxxx>

With the gmap code gone s390 can be easily converted to
LOCK_MM_AND_FIND_VMA like it has been done for most other
architectures.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
Reviewed-by: Gerald Schaefer <gerald.schaefer@xxxxxxxxxxxxx>
---
arch/s390/Kconfig | 1 +
arch/s390/mm/fault.c | 13 ++-----------
2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index d339fe4fdedf..8109446f7b24 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -224,6 +224,7 @@ config S390
select HAVE_VIRT_CPU_ACCOUNTING_IDLE
select IOMMU_HELPER if PCI
select IOMMU_SUPPORT if PCI
+ select LOCK_MM_AND_FIND_VMA
select MMU_GATHER_MERGE_VMAS
select MMU_GATHER_NO_GATHER
select MMU_GATHER_RCU_TABLE_FREE
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 93ae097ef0e0..8bd2b8d64273 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -308,18 +308,10 @@ static void do_exception(struct pt_regs *regs, int access)
return;
}
lock_mmap:
- mmap_read_lock(mm);
retry:
- vma = find_vma(mm, address);
+ vma = lock_mm_and_find_vma(mm, address, regs);
if (!vma)
- return handle_fault_error(regs, SEGV_MAPERR);
- if (unlikely(vma->vm_start > address)) {
- if (!(vma->vm_flags & VM_GROWSDOWN))
- return handle_fault_error(regs, SEGV_MAPERR);
- vma = expand_stack(mm, address);
- if (!vma)
- return handle_fault_error_nolock(regs, SEGV_MAPERR);
- }
+ return handle_fault_error_nolock(regs, SEGV_MAPERR);
if (unlikely(!(vma->vm_flags & access)))
return handle_fault_error(regs, SEGV_ACCERR);
fault = handle_mm_fault(vma, address, flags, regs);
@@ -337,7 +329,6 @@ static void do_exception(struct pt_regs *regs, int access)
}
if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED;
- mmap_read_lock(mm);
goto retry;
}
mmap_read_unlock(mm);
--
2.47.0