Re: [PATCH v4 2/2] mm/gup.c: Refactor check_and_migrate_movable_pages()

From: John Hubbard
Date: Wed Aug 17 2022 - 19:05:57 EST


On 8/17/22 15:50, Jason Gunthorpe wrote:

But why return 0 from the helper function in the first place?


The caller is looking for three distinct return code cases: 0, -EAGAIN,
or some other -errno. Unless you restructure more, you need all three
of those cases. The 0 case leads to the caller, __gup_longterm_locked,
returning nr_pages.

Here is the comment block that I recommended earlier in this thread, that
documents those cases:

https://lore.kernel.org/r/dc8fd102-ba30-d980-bdbb-11f39326103d@xxxxxxxxxx




thanks,
--
John Hubbard
NVIDIA