Re: [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free
"Darrick J. Wong" <[email protected]>
| Newsgroups | org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <20260821232412.GM6072@frogsfrogsfrogs> |
On Fri, Aug 21, 2026 at 05:03:37PM -0500, Eric Sandeen wrote:
> To obtain nr. of pages in "size" bytes, we need howmany(size, PAGE_SIZE)
> not howmany(size, PAGE_SHIFT). This over-reports reclaim by orders of
> magnitude, up to 4096x on a 64k page system.
>
> Fixes: e2874632a621 ("xfs: use vmalloc instead of vm_map_area for buffer backing memory")
> Cc: [email protected] # v6.15+
> Signed-off-by: Eric Sandeen <[email protected]>
Yikes.
Reviewed-by: "Darrick J. Wong" <[email protected]>
--D
> ---
> fs/xfs/xfs_buf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 1a5340baeabf..8256c1d13ce2 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -139,7 +139,7 @@ xfs_buf_free(
> ASSERT(list_empty(&bp->b_lru));
>
> if (!xfs_buftarg_is_mem(bp->b_target) && size >= PAGE_SIZE)
> - mm_account_reclaimed_pages(howmany(size, PAGE_SHIFT));
> + mm_account_reclaimed_pages(howmany(size, PAGE_SIZE));
>
> if (is_vmalloc_addr(bp->b_addr))
> vfree(bp->b_addr);
>
>