linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Gregory Price <gourry@gourry.net>
Cc: <linux-mm@kvack.org>, <linux-cxl@vger.kernel.org>,
	<nvdimm@lists.linux.dev>, <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<kernel-team@meta.com>, <dave@stgolabs.net>,
	<dave.jiang@intel.com>, <alison.schofield@intel.com>,
	<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
	<dan.j.williams@intel.com>, <willy@infradead.org>, <jack@suse.cz>,
	<terry.bowman@amd.com>, <john@jagalactic.com>,
	Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	"David Hildenbrand (Red Hat)" <david@kernel.org>
Subject: Re: [PATCH 1/9] mm/memory_hotplug: pass online_type to online_memory_block() via arg
Date: Mon, 2 Feb 2026 17:10:29 +0000	[thread overview]
Message-ID: <20260202171029.00005e80@huawei.com> (raw)
In-Reply-To: <20260129210442.3951412-2-gourry@gourry.net>

On Thu, 29 Jan 2026 16:04:34 -0500
Gregory Price <gourry@gourry.net> wrote:

> Modify online_memory_block() to accept the online type through its arg
> parameter rather than calling mhp_get_default_online_type() internally.
> This prepares for allowing callers to specify explicit online types.
> 
> Update the caller in add_memory_resource() to pass the default online
> type via a local variable.
> 
> No functional change.
> 
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
> Signed-off-by: Gregory Price <gourry@gourry.net>

Trivial comment inline. I don't really care either way.
Pushing the policy up to the caller and ensuring it's explicitly constant
for all the memory blocks (as opposed to relying on locks) seems sensible to me
even without anything else.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  mm/memory_hotplug.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index bc805029da51..87796b617d9e 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1337,7 +1337,9 @@ static int check_hotplug_memory_range(u64 start, u64 size)
>  
>  static int online_memory_block(struct memory_block *mem, void *arg)
>  {
> -	mem->online_type = mhp_get_default_online_type();
> +	int *online_type = arg;
> +
> +	mem->online_type = *online_type;
>  	return device_online(&mem->dev);
>  }
>  
> @@ -1578,8 +1580,12 @@ int add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
>  		merge_system_ram_resource(res);
>  
>  	/* online pages if requested */
> -	if (mhp_get_default_online_type() != MMOP_OFFLINE)
> -		walk_memory_blocks(start, size, NULL, online_memory_block);
> +	if (mhp_get_default_online_type() != MMOP_OFFLINE) {
> +		int online_type = mhp_get_default_online_type();

Maybe move the local variable outside the loop to avoid the double call.

> +
> +		walk_memory_blocks(start, size, &online_type,
> +				   online_memory_block);
> +	}
>  
>  	return ret;
>  error:



  reply	other threads:[~2026-02-02 17:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 21:04 [PATCH 0/9] cxl: explicit DAX driver selection and hotplug Gregory Price
2026-01-29 21:04 ` [PATCH 1/9] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-02-02 17:10   ` Jonathan Cameron [this message]
2026-02-02 17:46     ` Gregory Price
2026-01-29 21:04 ` [PATCH 2/9] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Gregory Price
2026-02-02 17:25   ` Jonathan Cameron
2026-02-02 18:02     ` Gregory Price
2026-02-02 18:46       ` Jonathan Cameron
2026-02-02 21:37         ` Gregory Price
2026-02-04 21:08           ` David Hildenbrand (arm)
2026-02-05  4:23             ` Gregory Price
2026-01-29 21:04 ` [PATCH 3/9] dax: plumb online_type from dax_kmem creators to hotplug Gregory Price
2026-01-29 21:04 ` [PATCH 4/9] drivers/cxl,dax: add dax driver mode selection for dax regions Gregory Price
2026-02-02 17:54   ` Jonathan Cameron
2026-01-29 21:04 ` [PATCH 5/9] cxl/core/region: move pmem region driver logic into pmem_region Gregory Price
2026-02-02 17:56   ` Jonathan Cameron
2026-01-29 21:04 ` [PATCH 6/9] cxl/core/region: move dax region device logic into dax_region.c Gregory Price
2026-02-02 17:57   ` Jonathan Cameron
2026-01-29 21:04 ` [PATCH 7/9] cxl/core: add cxl_devdax_region driver for explicit userland region binding Gregory Price
2026-01-29 21:04 ` [PATCH 8/9] cxl/core: Add dax_kmem_region and sysram_region drivers Gregory Price
2026-01-30 21:27   ` Cheatham, Benjamin
2026-01-30 22:12     ` Gregory Price
2026-02-02 17:02       ` Cheatham, Benjamin
2026-02-02 17:41         ` Gregory Price
2026-02-02 19:19         ` Gregory Price
2026-02-02 18:20   ` Jonathan Cameron
2026-02-02 18:23     ` Gregory Price
2026-01-29 21:04 ` [PATCH 9/9] Documentation/driver-api/cxl: add dax and sysram driver documentation Gregory Price
2026-01-29 21:17 ` [PATCH 0/9] cxl: explicit DAX driver selection and hotplug Gregory Price
2026-01-30 17:34 ` Gregory Price

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=20260202171029.00005e80@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=ira.weiny@intel.com \
    --cc=jack@suse.cz \
    --cc=john@jagalactic.com \
    --cc=kernel-team@meta.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=terry.bowman@amd.com \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.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