[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de66cef2-de14-4503-bbc6-21467e0e3e29@kernel.org>
Date: Wed, 26 Nov 2025 11:19:30 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: Mike Rapoport <rppt@...nel.org>, linux-mm@...ck.org
Cc: Andrea Arcangeli <aarcange@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, Hugh Dickins
<hughd@...gle.com>, James Houghton <jthoughton@...gle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Michal Hocko
<mhocko@...e.com>, Nikita Kalyazin <kalyazin@...zon.com>,
Paolo Bonzini <pbonzini@...hat.com>, Peter Xu <peterx@...hat.com>,
Sean Christopherson <seanjc@...gle.com>, Shuah Khan <shuah@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>, Vlastimil Babka <vbabka@...e.cz>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v2 3/5] mm: introduce VM_FAULT_UFFD_MINOR fault reason
> @@ -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))
> + return handle_userfault(vmf, VM_UFFD_MINOR);
> if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY |
> VM_FAULT_DONE_COW)))
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
--
Cheers
David
Powered by blists - more mailing lists