Re: [PATCH v2 2/3] iov_iter: introduce iov_iter_pin_user_pages*() routines

From: John Hubbard
Date: Sat Aug 29 2020 - 17:58:54 EST


On 8/29/20 7:58 AM, Christoph Hellwig wrote:
On Sat, Aug 29, 2020 at 01:08:52AM -0700, John Hubbard wrote:
...
@@ -1280,7 +1281,11 @@ static inline ssize_t __pipe_get_pages(struct iov_iter *i,
maxsize = n;
n += *start;
while (n > 0) {
- get_page(*pages++ = pipe->bufs[iter_head & p_mask].page);
+ if (use_pup)
+ pin_user_page(*pages++ = pipe->bufs[iter_head & p_mask].page);
+ else
+ get_page(*pages++ = pipe->bufs[iter_head & p_mask].page);

Maybe this would become a little more readable with a local variable
and a little more verbosity:

struct page *page = pipe->bufs[iter_head & p_mask].page;

if (use_pup)
pin_user_page(page);
else
get_page(page);

*pages++ = page;


Yes, that is cleaner, I'll change to that, thanks.

thanks,
--
John Hubbard
NVIDIA