Re: [PATCH v4 13/16] mm: Pass pvec directly to find_get_entries

From: Matthew Wilcox
Date: Sat Nov 14 2020 - 10:23:17 EST


On Sat, Nov 14, 2020 at 11:21:33AM +0100, Christoph Hellwig wrote:
> On Thu, Nov 12, 2020 at 09:26:38PM +0000, Matthew Wilcox (Oracle) wrote:
> > + pvec->nr = ret;
> > return ret;
>
> Do we need to return the number of found entries in addition to storing
> it in the pagevec?

We really only need a bool -- is pvec->nr zero or not. But we have the
number calculated so we may as well return it. All the current find_*()
behave this way and I haven't seen enough reason to change it yet.
Making it return void just makes the callers uglier. I have a batch of
patches to do something similar for find_get_pages / find_get_pages_range
/ pagevec_lookup / pagevec_lookup_range, but I don't need them for the
THP patchset, so I haven't sent them yet.