[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZD1JUzCJ7kz46hWX@nvidia.com>
Date: Mon, 17 Apr 2023 10:27:47 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Lorenzo Stoakes <lstoakes@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>,
David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH 4/7] mm/gup: introduce the FOLL_SAME_FILE GUP flag
On Mon, Apr 17, 2023 at 02:25:54PM +0100, Lorenzo Stoakes wrote:
> On Mon, Apr 17, 2023 at 10:14:02AM -0300, Jason Gunthorpe wrote:
> > On Sat, Apr 15, 2023 at 12:27:40AM +0100, Lorenzo Stoakes wrote:
> > > This flag causes GUP to assert that all VMAs within the input range possess
> > > the same vma->vm_file. If not, the operation fails.
> > >
> > > This is part of a patch series which eliminates the vmas parameter from the
> > > GUP API, implementing the one remaining assertion within the entire kernel
> > > that requires access to the VMAs associated with a GUP range.
> > >
> > > Signed-off-by: Lorenzo Stoakes <lstoakes@...il.com>
> > > ---
> > > include/linux/mm_types.h | 2 ++
> > > mm/gup.c | 16 ++++++++++++----
> > > 2 files changed, 14 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> > > index 3fc9e680f174..84d1aec9dbab 100644
> > > --- a/include/linux/mm_types.h
> > > +++ b/include/linux/mm_types.h
> > > @@ -1185,6 +1185,8 @@ enum {
> > > FOLL_PCI_P2PDMA = 1 << 10,
> > > /* allow interrupts from generic signals */
> > > FOLL_INTERRUPTIBLE = 1 << 11,
> > > + /* assert that the range spans VMAs with the same vma->vm_file */
> > > + FOLL_SAME_FILE = 1 << 12,
> >
> > I hope we don't add this flag, but it needs to be rejected in
> > internal_get_user_pages_fast()
> >
>
> intenal_get_user_pages_fast() checks against the complement of accepted
> masks, therefore it will reject this as-is unless I'm missing
> something.
Hmm, yes, that looks OK
> As for not adding the flag (an entirely understandable sentiment), it would
> be good to get an insight into the semantics of what you feel would be more
> suitable!
I'm hoping there is not a solid justification for why io_uring is
doing this check so we just delete it.
Jason
Powered by blists - more mailing lists