Re: pin_user_pages supports NULL pages arguments?

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

 



On Thu, Feb 10, 2022 at 11:20:31AM -0800, John Hubbard wrote:
> On 2/10/22 11:17, Minchan Kim wrote:
> >   * pin_user_pages() - pin user pages in memory for use by other devices
> >   < snip >
> >   * @pages:      array that receives pointers to the pages pinned.
> >   *              Should be at least nr_pages long. Or NULL, if caller
> >   *              only intends to ensure the pages are faulted in.
> > 
> > pin_user_pages(,, pages = NULL, );
> >    gup_flags |= FOLL_PIN
> >    __get_user_pages_locked
> >      __get_user_pages
> >        ..
> >        VM_BUG_ON(!!pages != !!(gup_flags & (FOLL_GET | FOLL_PIN)));
> 
> Only FOLL_GET or FOLL_PIN are supposed to fill in the **pages array. So
> if a caller passes a null **pages arg, then that caller must not also
> set FOLL_GET or FOLL_PIN. That's what the VM_BUG_ON() is expressing.

Yub, but pin_user_pages adds FOLL_PIN unconditinally and the comments
says it supports NUU pages argument. Isn't it conflict?

> 
> Perhaps that should be part of the documentation. It sort of is already,
> for get_user_pages*().

I expected it was just copied from get_user_pages.




[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