@@ -1564,7 +1571,8 @@ enum vm_fault_reason { { VM_FAULT_FALLBACK, "FALLBACK" }, \ { VM_FAULT_DONE_COW, "DONE_COW" }, \ { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" }, \
- { VM_FAULT_COMPLETED, "COMPLETED" }
- { VM_FAULT_COMPLETED, "COMPLETED" }, \
- { VM_FAULT_UFFD_MINOR, "UFFD_MINOR" }, \
struct vm_special_mapping { const char *name; /* The name, e.g. "[vdso]". */ diff --git a/mm/memory.c b/mm/memory.c index b59ae7ce42eb..94acbac8cefb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5279,6 +5279,8 @@ static vm_fault_t __do_fault(struct vm_fault *vmf) } ret = vma->vm_ops->fault(vmf);
- if (unlikely(ret & VM_FAULT_UFFD_MINOR))
if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY | VM_FAULT_DONE_COW)))return handle_userfault(vmf, VM_UFFD_MINOR);
If we want to reduce the overhead on the fast path, we can simply do
if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY | VM_FAULT_DONE_COW | VM_FAULT_UFFD_MINOR))) { if (unlikely(ret & VM_FAULT_UFFD_MINOR)) return handle_userfault(vmf, VM_UFFD_MINOR); return ret; }
Maybe the compiler already does that to improve the likely case.
LGTM