arm: mm: try VMA lock-based page fault handling first
PATCH 1/1 arm: mm: try VMA lock-based page fault handling first
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails, the ebizzy benchmark shows 25% improvement(records/s) on qemu with 2 cpus.
--- arch/arm/Kconfig | 1 + arch/arm/mm/fault.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
arch/arm/Kconfig +1 -0
@@ -34,6 +34,7 @@ config ARM select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7 select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE + select ARCH_SUPPORTS_PER_VMA_LOCK select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF select ARCH_USE_MEMTEST
arch/arm/mm/fault.c +30 -0
@@ -278,6 +278,35 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)perf_sw_event (PERF_COUNT_SW_PAGE_FAULTS ,1 , regs, addr); +if (!(flags &FAULT_FLAG_USER )) + goto lock_mmap; + + vma =lock_vma_under_rcu (mm, addr); +if (!vma) + goto lock_mmap; + +if (!(vma->vm_flags & vm_flags)) { +vma_end_read (vma); + goto lock_mmap; + } + fault =handle_mm_fault (vma, addr, flags |FAULT_FLAG_VMA_LOCK , regs); +if (!(fault & (VM_FAULT_RETRY |VM_FAULT_COMPLETED ))) +vma_end_read (vma); + +if (!(fault &VM_FAULT_RETRY )) { +count_vm_vma_lock_event (VMA_LOCK_SUCCESS ); + goto done; + } +count_vm_vma_lock_event (VMA_LOCK_RETRY ); + +/* Quick path to respond to signals */ +if (fault_signal_pending (fault, regs)) { +if (!user_mode (regs)) + goto no_context; +return 0 ; + } +lock_mmap: + retry: vma =lock_mm_and_find_vma (mm, addr, regs);if (unlikely (!vma)) {
@@ -316,6 +345,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) }mmap_read_unlock (mm); +done:/* * Handle the "normal" case first - VM_FAULT_MAJOR
Signature · 7 lines
2.27.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Russell King (Oracle)
maintainerQuoted 3 lines · Kefeng Wang
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails, the ebizzy benchmark shows 25% improvement(records/s) on qemu with 2 cpus.
Looks fine to me, but I wonder how much of this code gets repeated in the other architectures.
What is the plan for merging this? If you would like me to apply it, please submit it to the patch system, details in my signature below.
Thanks.
Signature · 7 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 7 lines · Russell King (Oracle)
Quoted 3 lines · Kefeng Wang
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails, the ebizzy benchmark shows 25% improvement(records/s) on qemu with 2 cpus.
Looks fine to me, but I wonder how much of this code gets repeated in the other architectures.
Thanks, I post a rfc to reduce the code reduplication between archs, but not too much reply about it[1], so I give up.
Quoted 4 lines
What is the plan for merging this? If you would like me to apply it, please submit it to the patch system, details in my signature below.
sure, I will submit via arm patch system.
[1]https://lore.kernel.org/linux-mm/[email protected]/
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel