public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: introduce CPU hotplug infrastructure
Date: Mon, 7 Jun 2021 21:14:27 -0700	[thread overview]
Message-ID: <20210608041427.GQ2945738@locust> (raw)
In-Reply-To: <20210607001714.GY664593@dread.disaster.area>

On Mon, Jun 07, 2021 at 10:17:14AM +1000, Dave Chinner wrote:
> 
> From: Dave Chinner <dchinner@redhat.com>
> 
> We need to move to per-cpu state for CIL tracking, but to do that we
> need to handle CPUs being removed from the system by the hot-plug
> code. Introduce generic XFS infrastructure to handle CPU hotplug
> events that is set up at module init time and torn down at module
> exit time.
> 
> Initially, the CIL only needs CPU dead notifications, so we only set
> up a callback for these notifications. The infrastructure can be
> updated in future for CPU add notifications easily if every needed.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Looks good,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_super.c         | 38 +++++++++++++++++++++++++++++++++++++-
>  include/linux/cpuhotplug.h |  1 +
>  2 files changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 017ba9c24c2d..0146d3c89da9 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -2123,6 +2123,35 @@ xfs_destroy_workqueues(void)
>  	destroy_workqueue(xfs_alloc_wq);
>  }
>  
> +static int
> +xfs_cpu_dead(
> +	unsigned int		cpu)
> +{
> +	return 0;
> +}
> +
> +static int __init
> +xfs_cpu_hotplug_init(void)
> +{
> +	int	error;
> +
> +	error = cpuhp_setup_state_nocalls(CPUHP_XFS_DEAD,
> +					"xfs:dead", NULL,
> +					xfs_cpu_dead);
> +	if (error < 0) {
> +		xfs_alert(NULL,
> +"Failed to initialise CPU hotplug, error %d. XFS is non-functional.",
> +			error);
> +	}
> +	return error;
> +}
> +
> +static void
> +xfs_cpu_hotplug_destroy(void)
> +{
> +	cpuhp_remove_state_nocalls(CPUHP_XFS_DEAD);
> +}
> +
>  STATIC int __init
>  init_xfs_fs(void)
>  {
> @@ -2135,10 +2164,14 @@ init_xfs_fs(void)
>  
>  	xfs_dir_startup();
>  
> -	error = xfs_init_zones();
> +	error = xfs_cpu_hotplug_init();
>  	if (error)
>  		goto out;
>  
> +	error = xfs_init_zones();
> +	if (error)
> +		goto out_destroy_hp;
> +
>  	error = xfs_init_workqueues();
>  	if (error)
>  		goto out_destroy_zones;
> @@ -2218,6 +2251,8 @@ init_xfs_fs(void)
>  	xfs_destroy_workqueues();
>   out_destroy_zones:
>  	xfs_destroy_zones();
> + out_destroy_hp:
> +	xfs_cpu_hotplug_destroy();
>   out:
>  	return error;
>  }
> @@ -2240,6 +2275,7 @@ exit_xfs_fs(void)
>  	xfs_destroy_workqueues();
>  	xfs_destroy_zones();
>  	xfs_uuid_table_free();
> +	xfs_cpu_hotplug_destroy();
>  }
>  
>  module_init(init_xfs_fs);
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index 4a62b3980642..bf8f29ad9bf8 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -52,6 +52,7 @@ enum cpuhp_state {
>  	CPUHP_FS_BUFF_DEAD,
>  	CPUHP_PRINTK_DEAD,
>  	CPUHP_MM_MEMCQ_DEAD,
> +	CPUHP_XFS_DEAD,
>  	CPUHP_PERCPU_CNT_DEAD,
>  	CPUHP_RADIX_DEAD,
>  	CPUHP_PAGE_ALLOC_DEAD,

  reply	other threads:[~2021-06-08  4:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04  3:29 [GIT PULL] xfs: CIL and log scalability improvements Dave Chinner
2021-06-05  2:03 ` Darrick J. Wong
2021-06-05  2:15   ` Darrick J. Wong
2021-06-05 21:43     ` Dave Chinner
2021-06-05 22:29       ` Darrick J. Wong
2021-06-06 22:11     ` Dave Chinner
2021-06-07  0:00       ` Dave Chinner
2021-06-07  0:17         ` [PATCH 1/2] xfs: introduce CPU hotplug infrastructure Dave Chinner
2021-06-08  4:14           ` Darrick J. Wong [this message]
2021-06-07  0:18         ` [PATCH 2/2] xfs: introduce per-cpu CIL tracking structure Dave Chinner
2021-06-07 21:59         ` [GIT PULL] xfs: CIL and log scalability improvements Darrick J. Wong

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=20210608041427.GQ2945738@locust \
    --to=djwong@kernel.org \
    --cc=david@fromorbit.com \
    --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