Re: [PATCH v2 1/2] mm: reorganize internal_get_user_pages_fast()

From: Peter Xu
Date: Fri Oct 30 2020 - 18:37:05 EST


On Fri, Oct 30, 2020 at 11:46:20AM -0300, Jason Gunthorpe wrote:
> The next patch in this series makes the lockless flow a little more
> complex, so move the entire block into a new function and remove a level
> of indention. Tidy a bit of cruft:
>
> - addr is always the same as start, so use start
>
> - Use the modern check_add_overflow() for computing end = start + len
>
> - nr_pinned/pages << PAGE_SHIFT needs the LHS to be unsigned long to
> avoid shift overflow, make the variables unsigned long to avoid coding
> casts in both places. nr_pinned was missing its cast
>
> - The handling of ret and nr_pinned can be streamlined a bit
>
> No functional change.
>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Sorry for a very late reply (due to other distractions):

Reviewed-by: Peter Xu <peterx@xxxxxxxxxx>

Thanks,

--
Peter Xu