Re: [PATCH 5/8] mm/gup: add FOLL_UNLOCK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 23, 2023 at 12:37:17PM +0100, David Hildenbrand wrote:
> On 17.01.23 16:58, Jason Gunthorpe wrote:
> > Setting FOLL_UNLOCK allows GUP to lock/unlock the mmap lock on its own. It
> > is a more explicit replacement for locked != NULL. This clears the way for
> > passing in locked = 1, without intending that the lock can be unlocked.
> > 
> > Set the flag in all cases where it is used, eg locked is present in the
> > external interface or locked is used internally with locked = 0.
> > 
> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> > ---
> >   include/linux/mm.h |  1 +
> >   mm/gup.c           | 31 +++++++++++++++++++------------
> >   2 files changed, 20 insertions(+), 12 deletions(-)
> > 
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index f3f196e4d66d6f..7496a5c8acede1 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -3089,6 +3089,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
> >   #define FOLL_FAST_ONLY	0x80000	/* gup_fast: prevent fall-back to slow gup */
> >   #define FOLL_PCI_P2PDMA	0x100000 /* allow returning PCI P2PDMA pages */
> >   #define FOLL_INTERRUPTIBLE  0x200000 /* allow interrupts from generic signals */
> > +#define FOLL_UNLOCK	0x400000 /* allow unlocking the mmap lock */
> 
> So it's more like "FOLL_UNLOCKABLE" ? FOLL_UNLOCK sounds like an instruction
> instead.

Sure, I renamed it

> Not that I particularly like adding new internal FOLL flags where avoidable
> :P

How about, I made a patch to move all the internal FOLL_ flags into
mm/internal.h ?

Jason




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux