Messages in this thread | | | Date | Tue, 11 Apr 2023 15:13:18 -0400 | From | Peter Xu <> | Subject | Re: [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
| |