Re: [PATCH v3 2/2] btrfs: allocate page arrays using bulk page allocator

From: David Sterba
Date: Fri Apr 01 2022 - 09:30:06 EST


On Thu, Mar 31, 2022 at 02:19:07PM -0400, Sweet Tea Dorminy wrote:
> > Also in the xfs code there's memalloc_retry_wait() which is supposed to be
> > called when repeated memory allocation is retried. What was the reason
> > you removed it?
>
> Trying to keep the behavior as close as possible to the existing behavior.

I see, makes sense.

> The current behavior of each alloc_page loop is to fail if alloc_page()
> fails; in the worst case, alloc_pages_bulk_array() calls alloc_page()
> after trying to get a batch, so I figured the worst case is still
> basically a loop calling alloc_page() and failing if it ever fails.
>
> Reading up on it, though, arguably the memalloc_retry_wait() should
> already be in all the callsites, so maybe I should insert a patch in the
> middle that just adds the memalloc_retry_wait() into
> btrfs_alloc_page_array()? Since it's an orthogonal fixup to either the
> refactoring or the conversion to alloc_pages_bulk_array()?

Yeah a separate patch with the reasonig about the potential effects is
better. The v3 is now in misc-next with the suggested loop refactoring,
so please send the memalloc_retry_wait() update on top of that. Thanks.