Re: [PATCH 5/6] userfaultfd: decouple fault reason from VMA flags

"Lorenzo Stoakes (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 <ao1-FMVkGlTtGDNy@gremlin>
On Tue, Aug 25, 2026 at 01:08:33PM +0200, David Hildenbrand (Arm) wrote:
>
> >>> @@ -2793,14 +2793,14 @@ static inline bool userfaultfd_must_wait(struct userfaultfd_ctx *ctx,
> >>>  	 * If VMA has UFFD WP faults enabled and WP fault, wait for userspace to
> >>>  	 * resolve the fault.
> >>>  	 */
> >>> -	if (!pte_write(ptent) && (reason & VM_UFFD_WP))
> >>> +	if (!pte_write(ptent) && (reason & USERFAULT_WP))
> >>
> >> I wonder if you could actually
> >>
> >> You do this quite a lot and they read a bit horribly with the && and & on the
> >> same sight-line. With the changes to the enum proposed above you could do:
> >>
> >> 	if (!pte_write(ptent) && test_bit(reason, USERFAULT_WP_BIT))
> >
> > I find && and & perfectly readable and adding _BIT defines looks really
> > excessive to me.
>
> Yeah, that looks alright to me as well.

I find the general inconsistent different sets of flags/bits but not
really/naming all a bit of a mess.

But these are largely aesthetic and I don't maintain this file so I guess
you guys can live without my tag here...

>
> --
> Cheers,
>
> David

--
Cheers, Lorenzo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.