On Fri 23-10-20 21:44:17, John Hubbard wrote:
> On 10/23/20 5:19 PM, Jason Gunthorpe wrote:
> > +   start += (unsigned long)nr_pinned << PAGE_SHIFT;
> > +   pages += nr_pinned;
> > +   ret = __gup_longterm_unlocked(start, nr_pages - nr_pinned, gup_flags,
> > +                                 pages);
> > +   if (ret < 0) {
> >             /* Have to be a bit careful with return values */
> 
> ...and can we move that comment up one level, so that it reads:
> 
>       /* Have to be a bit careful with return values */
>       if (ret < 0) {
>               if (nr_pinned)
>                       return nr_pinned;
>               return ret;
>       }
>       return ret + nr_pinned;
> 
> Thinking about this longer term, it would be nice if the whole gup/pup API
> set just stopped pretending that anyone cares about partial success, because
> they *don't*. If we had return values of "0 or -ERRNO" throughout, and an
> additional set of API wrappers that did some sort of limited retry just like
> some of the callers do, that would be a happier story.

Actually there are callers that care about partial success. See e.g.
iov_iter_get_pages() usage in fs/direct_io.c:dio_refill_pages() or
bio_iov_iter_get_pages(). These places handle partial success just fine and
not allowing partial success from GUP could regress things...

                                                                Honza
-- 
Jan Kara <j...@suse.com>
SUSE Labs, CR

Reply via email to