Re: [RFC PATCH v2 35/47] userfaultfd: require UFFD_FEATURE_EXACT_ADDRESS when using HugeTLB HGM
From: James Houghton
Date: Tue Dec 27 2022 - 11:40:52 EST
On Thu, Dec 22, 2022 at 4:47 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
>
> On Fri, Oct 21, 2022 at 04:36:51PM +0000, James Houghton wrote:
> > @@ -1990,6 +1990,17 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx,
> > ~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM);
> > #ifndef CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING
> > uffdio_api.features &= ~UFFD_FEATURE_MINOR_HUGETLBFS_HGM;
> > +#else
> > +
> > + ret = -EINVAL;
> > + if ((uffdio_api.features & UFFD_FEATURE_MINOR_HUGETLBFS_HGM) &&
> > + !(uffdio_api.features & UFFD_FEATURE_EXACT_ADDRESS))
>
> This check needs to be done upon "features" or "ctx_features", rather than
> "uffdio_api.features". The latter is the one we'll report to the user only.
Ack, thanks Peter. I'm going to drop this patch given the API change
(switching to MADV_SPLIT).
- James