Re: [PATCH 14/29] selftests/mm: uffd_[un]register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 11, 2023 at 03:13:18PM -0400, Peter Xu wrote:
> On Fri, Apr 07, 2023 at 02:08:54PM +0300, Mike Rapoport wrote:
> > > @@ -96,11 +95,7 @@ static void register_region_with_uffd(char *addr, size_t len)
> > >  	 * handling by the userfaultfd object. In mode, we request to track
> > >  	 * missing pages (i.e., pages that have not yet been faulted in).
> > >  	 */
> > > -
> > > -	uffdio_register.range.start = (unsigned long)addr;
> > > -	uffdio_register.range.len = len;
> > > -	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
> > > -	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) {
> > > +	if (uffd_register(uffd, addr, len, true, false, false)) {
> > 
> > I'd replace booleans with a bit flags as it easier to read.
> > Other than that LGTM.
> 
> It was mostly for no need to remember the long names of macros, and easier
> when conditionally set with some modes. E.g., we have 5 callers have things
> like:
> 
>   uffd_register(..., test_uffdio_wp ? UFFDIO_REGISTER_MODE_WP : 0);
> 
> The bools simplifes it to:
> 
>   uffd_register(..., test_uffdio_wp, ...);
> 
> But let me know if you still think that's better - I can switch here.

No strong feelings, however you prefer.
 
> Thanks,
> 
> -- 
> Peter Xu
> 

-- 
Sincerely yours,
Mike.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux