lkml.org 
[lkml]   [2023]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 14/29] selftests/mm: uffd_[un]register()
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.

Thanks,

--
Peter Xu

\
 
 \ /
  Last update: 2023-04-11 21:14    [W:0.206 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site