Commit 4c6c0020 authored by Kefeng Wang's avatar Kefeng Wang Committed by Palmer Dabbelt

riscv: mm: accelerate pagefault when badaccess

The access_error() of vma already checked under per-VMA lock, if it
is a bad access, directly handle error, no need to retry with mmap_lock
again. 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>
Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240403083805.1818160-6-wangkefeng.wang@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 9850e73e
...@@ -293,8 +293,8 @@ void handle_page_fault(struct pt_regs *regs) ...@@ -293,8 +293,8 @@ void handle_page_fault(struct pt_regs *regs)
if (unlikely(access_error(cause, vma))) { if (unlikely(access_error(cause, vma))) {
vma_end_read(vma); vma_end_read(vma);
count_vm_vma_lock_event(VMA_LOCK_SUCCESS); count_vm_vma_lock_event(VMA_LOCK_SUCCESS);
tsk->thread.bad_cause = cause; tsk->thread.bad_cause = SEGV_ACCERR;
bad_area_nosemaphore(regs, SEGV_ACCERR, addr); bad_area_nosemaphore(regs, code, addr);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment