Re: [PATCH 12/12] xfs: trace what memory backs a buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2025 at 07:51:40AM -0800, Christoph Hellwig wrote:
> Add three trace points for the different backing memory allocators for
> buffers.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>

--D

> ---
>  fs/xfs/xfs_buf.c   | 4 ++++
>  fs/xfs/xfs_trace.h | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 0393dd302cf6..a396b628e9b0 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -299,6 +299,7 @@ xfs_buf_alloc_kmem(
>  		return -ENOMEM;
>  	}
>  	bp->b_flags |= _XBF_KMEM;
> +	trace_xfs_buf_backing_kmem(bp, _RET_IP_);
>  	return 0;
>  }
>  
> @@ -379,9 +380,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:
> @@ -395,6 +398,7 @@ xfs_buf_alloc_backing_mem(
>  		memalloc_retry_wait(gfp_mask);
>  	}
>  
> +	trace_xfs_buf_backing_vmalloc(bp, _RET_IP_);
>  	return 0;
>  }
>  
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index b29462363b81..c8f64daf6d75 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -545,6 +545,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);
> -- 
> 2.45.2
> 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux