linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free
@ 2026-08-21 22:03 Eric Sandeen
  2026-08-21 23:24 ` Darrick J. Wong
  2026-08-24  4:47 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2026-08-21 22:03 UTC (permalink / raw)
  To: linux-xfs@vger.kernel.org; +Cc: Christoph Hellwig

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: stable@vger.kernel.org # v6.15+
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 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);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free
  2026-08-21 22:03 [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free Eric Sandeen
@ 2026-08-21 23:24 ` Darrick J. Wong
  2026-08-24  4:47 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2026-08-21 23:24 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs@vger.kernel.org, Christoph Hellwig

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: stable@vger.kernel.org # v6.15+
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Yikes.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--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);
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free
  2026-08-21 22:03 [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free Eric Sandeen
  2026-08-21 23:24 ` Darrick J. Wong
@ 2026-08-24  4:47 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-08-24  4:47 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs@vger.kernel.org, Christoph Hellwig

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.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-24  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 22:03 [PATCH] xfs: fix reclaimed page accounting in xfs_buf_free Eric Sandeen
2026-08-21 23:24 ` Darrick J. Wong
2026-08-24  4:47 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).