]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: trace what memory backs a buffer
authorChristoph Hellwig <hch@lst.de>
Mon, 10 Mar 2025 13:19:15 +0000 (14:19 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 10 Mar 2025 13:29:44 +0000 (14:29 +0100)
Add three trace points for the different backing memory allocators for
buffers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c
fs/xfs/xfs_trace.h

index a7430fcd8301fed2f237fc0d9ff12f812833706e..106ee81fa56f5a28456c2ec6a3792bfd9911c756 100644 (file)
@@ -240,6 +240,7 @@ xfs_buf_alloc_kmem(
                return -ENOMEM;
        }
        bp->b_flags |= _XBF_KMEM;
+       trace_xfs_buf_backing_kmem(bp, _RET_IP_);
        return 0;
 }
 
@@ -319,9 +320,11 @@ xfs_buf_alloc_backing_mem(
        if (!folio) {
                if (size <= PAGE_SIZE)
                        return -ENOMEM;
+               trace_xfs_buf_backing_fallback(bp, _RET_IP_);
                goto fallback;
        }
        bp->b_addr = folio_address(folio);
+       trace_xfs_buf_backing_folio(bp, _RET_IP_);
        return 0;
 
 fallback:
@@ -335,6 +338,7 @@ fallback:
                memalloc_retry_wait(gfp_mask);
        }
 
+       trace_xfs_buf_backing_vmalloc(bp, _RET_IP_);
        return 0;
 }
 
index 83f894c07866a9463a078f585b50777cfc9dd283..e56ba1963160de67fb0f61496a3687efd8e65b00 100644 (file)
@@ -692,6 +692,10 @@ DEFINE_BUF_EVENT(xfs_buf_iodone_async);
 DEFINE_BUF_EVENT(xfs_buf_error_relse);
 DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
+DEFINE_BUF_EVENT(xfs_buf_backing_folio);
+DEFINE_BUF_EVENT(xfs_buf_backing_kmem);
+DEFINE_BUF_EVENT(xfs_buf_backing_vmalloc);
+DEFINE_BUF_EVENT(xfs_buf_backing_fallback);
 
 /* not really buffer traces, but the buf provides useful information */
 DEFINE_BUF_EVENT(xfs_btree_corrupt);