public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/4] xfs: split the page fault trace event
Date: Tue, 29 Oct 2024 08:51:27 -0700	[thread overview]
Message-ID: <20241029155127.GU2386201@frogsfrogsfrogs> (raw)
In-Reply-To: <20241029151214.255015-2-hch@lst.de>

On Tue, Oct 29, 2024 at 04:11:57PM +0100, Christoph Hellwig wrote:
> Split the xfs_filemap_fault trace event into separate ones for read and
> write faults and move them into the applicable locations.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Yay nice split!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_file.c  |  8 ++++++--
>  fs/xfs/xfs_trace.h | 20 ++++++++++++--------
>  2 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index b19916b11fd5..20f7f92b8867 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -1425,6 +1425,8 @@ xfs_dax_read_fault(
>  	struct xfs_inode	*ip = XFS_I(file_inode(vmf->vma->vm_file));
>  	vm_fault_t		ret;
>  
> +	trace_xfs_read_fault(ip, order);
> +
>  	xfs_ilock(ip, XFS_MMAPLOCK_SHARED);
>  	ret = xfs_dax_fault_locked(vmf, order, false);
>  	xfs_iunlock(ip, XFS_MMAPLOCK_SHARED);
> @@ -1442,6 +1444,8 @@ xfs_write_fault(
>  	unsigned int		lock_mode = XFS_MMAPLOCK_SHARED;
>  	vm_fault_t		ret;
>  
> +	trace_xfs_write_fault(ip, order);
> +
>  	sb_start_pagefault(inode->i_sb);
>  	file_update_time(vmf->vma->vm_file);
>  
> @@ -1485,12 +1489,12 @@ __xfs_filemap_fault(
>  {
>  	struct inode		*inode = file_inode(vmf->vma->vm_file);
>  
> -	trace_xfs_filemap_fault(XFS_I(inode), order, write_fault);
> -
>  	if (write_fault)
>  		return xfs_write_fault(vmf, order);
>  	if (IS_DAX(inode))
>  		return xfs_dax_read_fault(vmf, order);
> +
> +	trace_xfs_read_fault(XFS_I(inode), order);
>  	return filemap_fault(vmf);
>  }
>  
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index ee9f0b1f548d..efc4aae295aa 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -827,28 +827,32 @@ DEFINE_INODE_EVENT(xfs_inode_inactivating);
>  TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
>  TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
>  
> -TRACE_EVENT(xfs_filemap_fault,
> -	TP_PROTO(struct xfs_inode *ip, unsigned int order, bool write_fault),
> -	TP_ARGS(ip, order, write_fault),
> +DECLARE_EVENT_CLASS(xfs_fault_class,
> +	TP_PROTO(struct xfs_inode *ip, unsigned int order),
> +	TP_ARGS(ip, order),
>  	TP_STRUCT__entry(
>  		__field(dev_t, dev)
>  		__field(xfs_ino_t, ino)
>  		__field(unsigned int, order)
> -		__field(bool, write_fault)
>  	),
>  	TP_fast_assign(
>  		__entry->dev = VFS_I(ip)->i_sb->s_dev;
>  		__entry->ino = ip->i_ino;
>  		__entry->order = order;
> -		__entry->write_fault = write_fault;
>  	),
> -	TP_printk("dev %d:%d ino 0x%llx order %u write_fault %d",
> +	TP_printk("dev %d:%d ino 0x%llx order %u",
>  		  MAJOR(__entry->dev), MINOR(__entry->dev),
>  		  __entry->ino,
> -		  __entry->order,
> -		  __entry->write_fault)
> +		  __entry->order)
>  )
>  
> +#define DEFINE_FAULT_EVENT(name) \
> +DEFINE_EVENT(xfs_fault_class, name, \
> +	TP_PROTO(struct xfs_inode *ip, unsigned int order), \
> +	TP_ARGS(ip, order))
> +DEFINE_FAULT_EVENT(xfs_read_fault);
> +DEFINE_FAULT_EVENT(xfs_write_fault);
> +
>  DECLARE_EVENT_CLASS(xfs_iref_class,
>  	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
>  	TP_ARGS(ip, caller_ip),
> -- 
> 2.45.2
> 
> 

  reply	other threads:[~2024-10-29 15:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 15:11 misc page fault handler cleanups Christoph Hellwig
2024-10-29 15:11 ` [PATCH 1/4] xfs: split the page fault trace event Christoph Hellwig
2024-10-29 15:51   ` Darrick J. Wong [this message]
2024-10-29 15:11 ` [PATCH 2/4] xfs: split write fault handling out of __xfs_filemap_fault Christoph Hellwig
2024-10-29 15:57   ` Darrick J. Wong
2024-10-29 15:11 ` [PATCH 3/4] xfs: remove __xfs_filemap_fault Christoph Hellwig
2024-10-29 16:00   ` Darrick J. Wong
2024-10-29 15:12 ` [PATCH 4/4] xfs: remove xfs_page_mkwrite_iomap_ops Christoph Hellwig
2024-10-29 15:56   ` Darrick J. Wong
2024-10-30  4:45     ` Christoph Hellwig
2024-10-29 20:54 ` misc page fault handler cleanups Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241029155127.GU2386201@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox