Re: [PATCH 5/6] userfaultfd: decouple fault reason from VMA flags
"David Hildenbrand (Arm)" <[email protected]>
| Newsgroups | org.kernel.vger.linux-doc,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-trace-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On 8/23/26 14:17, Mike Rapoport (Microsoft) wrote: > Introduce enum uffd_reason to define reasons for user faults rather than > overload VM_UFFD_* VMA flags for that. > > Using a dedicated enum makes the code clearer and decoupling the fault > reason from VMA flags clears the way for moving the uffd mode bits out > of VMA namespace. > > No functional change. > > Assisted-by: copilot:claude-opus-4.6 > Signed-off-by: Mike Rapoport (Microsoft) <[email protected]> > --- > include/linux/userfaultfd_k.h | 16 ++++++++++++++-- > include/uapi/linux/userfaultfd.h | 6 +++--- > mm/huge_memory.c | 6 +++--- > mm/hugetlb.c | 10 +++++----- > mm/memory.c | 10 +++++----- > mm/shmem.c | 4 ++-- > mm/userfaultfd.c | 30 +++++++++++++++--------------- > 7 files changed, 47 insertions(+), 35 deletions(-) > > diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h > index 45355bdb4ec7..f401623f315d 100644 > --- a/include/linux/userfaultfd_k.h > +++ b/include/linux/userfaultfd_k.h > @@ -9,6 +9,18 @@ > #ifndef _LINUX_USERFAULTFD_K_H > #define _LINUX_USERFAULTFD_K_H > > +#include <linux/bits.h> > + > +/* Fault reason #PF handler passes to handle_userfault() */ > +enum uf_reason { Can we just call this "userfault_reason" or "uffd_reason" ? Maybe the latter is actually what we want? -- Cheers, David