[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZDbfjxFkxKVATjVQ@linux.ibm.com>
Date: Wed, 12 Apr 2023 19:42:55 +0300
From: Mike Rapoport <rppt@...ux.ibm.com>
To: Peter Xu <peterx@...hat.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrea Arcangeli <aarcange@...hat.com>,
David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Nadav Amit <nadav.amit@...il.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Leonardo Bras Soares Passos <lsoaresp@...hat.com>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>
Subject: Re: [PATCH 14/29] selftests/mm: uffd_[un]register()
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.
Powered by blists - more mailing lists