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

From: Jason Gunthorpe
Date: Wed Aug 17 2022 - 19:40:53 EST


On Thu, Aug 18, 2022 at 09:24:28AM +1000, Alistair Popple wrote:
> collected = collect_longterm_unpinnable_pages(&movable_page_list,
> nr_pages, pages);
> if (collected == 0)
> return 0;
>
> ret = migrate_longterm_unpinnable_pages(&movable_page_list, nr_pages,
> pages);
> if (ret)
> return ret;
>
> return -EAGAIN;
>
> Which IMHO looks at lot more normal and sane than what I had.

That isn't "success oriented flow" :)

> > But why return 0 from the helper function in the first place?
>
> To stick with the paradigm of 0 == success. Ie.

But it doesn't mean success if we squashed it to EAGAIN here.

-EAGAIN == retry
0 == success, real success
everything else == -ERRNO, failure

Stick with one convection in all the functions in this file in this grouping.

Jason