Commit 67c3cd13 authored by Kefeng Wang's avatar Kefeng Wang Committed by Peng Zhang
Browse files

arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS

maillist inclusion
category: performance
bugzilla: https://gitee.com/openeuler/kernel/issues/I9E07B
CVE: NA

Reference: https://lore.kernel.org/linux-mm/20240403083805.1818160-1-wangkefeng.wang@huawei.com/



--------------------------------

The vm_flags of vma already checked under per-VMA lock, if it is a
bad access, directly set fault to VM_FAULT_BADACCESS and handle error,
no need to retry with mmap_lock again, the latency time reduces 34% in
'lat_sig -P 1 prot lat_sig' from lmbench testcase.

Since the page faut is handled under per-VMA lock, count it as a vma lock
event with VMA_LOCK_SUCCESS.

Reviewed-by: default avatarSuren Baghdasaryan <surenb@google.com>
Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent 1501c0a6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -622,7 +622,9 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,

	if (!(vma->vm_flags & vm_flags)) {
		vma_end_read(vma);
		goto lock_mmap;
		fault = VM_FAULT_BADACCESS;
		count_vm_vma_lock_event(VMA_LOCK_SUCCESS);
		goto done;
	}
	fault = handle_mm_fault(vma, addr, mm_flags | FAULT_FLAG_VMA_LOCK, regs);
	if (!(fault & (VM_FAULT_RETRY | VM_FAULT_COMPLETED)))