Re: [PATCH 2/2] btrfs: Allocate page arrays using bulk page allocator.
From: Nikolay Borisov
Date: Tue Mar 29 2022 - 14:31:34 EST
On 28.03.22 г. 23:14 ч., Sweet Tea Dorminy wrote:
While calling alloc_page() in a loop is an effective way to populate an
array of pages, the kernel provides a method to allocate pages in bulk.
alloc_pages_bulk_array() populates the NULL slots in a page array, trying to
grab more than one page at a time.
Unfortunately, it doesn't guarantee allocating all slots in the array,
but it's easy to call it in a loop and return an error if no progress
occurs. Similar code can be found in xfs/xfs_buf.c:xfs_buf_alloc_pages().
Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@xxxxxxxxxx>
Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>