From: David Hildenbrand <david@redhat.com>
To: Hannes Reinecke <hare@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>, linux-mm@kvack.org
Subject: Re: [PATCH 3/3] drivers/base: move memory_block_add_nid() into the caller
Date: Fri, 4 Jul 2025 09:48:35 +0200 [thread overview]
Message-ID: <b24a53b3-86e4-461d-834d-46780c454504@redhat.com> (raw)
In-Reply-To: <20250704063404.27495-4-hare@kernel.org>
On 04.07.25 08:34, Hannes Reinecke wrote:
> Now the node id only needs to be set for early memory, so move
> memory_block_add_nid() into the caller and rename it into
> memory_block_add_nid_early(). This allows us to further simplify
> the code by dropping the 'context' argument to
> do_register_memory_block_under_node().
>
> Suggested-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Hannes Reinecke <hare@kernel.org>
> Acked-by: David Hildenbrand <david@redhat.com>
> ---
> drivers/base/memory.c | 36 ++++++++++++++++++------------------
> drivers/base/node.c | 10 ++++------
> include/linux/memory.h | 3 +--
> 3 files changed, 23 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 4ce93fb54525..5fb275d7ed7d 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -782,21 +782,22 @@ static struct zone *early_node_zone_for_memory_block(struct memory_block *mem,
>
> #ifdef CONFIG_NUMA
> /**
> - * memory_block_add_nid() - Indicate that system RAM falling into this memory
> - * block device (partially) belongs to the given node.
> + * memory_block_add_nid_early() - Indicate that early system RAM falling into
> + * this memory block device (partially) belongs
> + * to the given node.
> * @mem: The memory block device.
> * @nid: The node id.
> - * @context: The memory initialization context.
> *
> - * Indicate that system RAM falling into this memory block (partially) belongs
> - * to the given node. If the context indicates ("early") that we are adding the
> - * node during node device subsystem initialization, this will also properly
> - * set/adjust mem->zone based on the zone ranges of the given node.
> + * Indicate that early system RAM falling into this memory block (partially)
> + * belongs to the given node. This will also properly set/adjust mem->zone based
> + * on the zone ranges of the given node.
> + *
> + * Memory hotplug handles this on memory block creation, where we can only have
> + * a single nid span a memory block.
> */
> -void memory_block_add_nid(struct memory_block *mem, int nid,
> - enum meminit_context context)
> +void memory_block_add_nid_early(struct memory_block *mem, int nid)
> {
> - if (context == MEMINIT_EARLY && mem->nid != nid) {
> + if (mem->nid != nid) {
> /*
> * For early memory we have to determine the zone when setting
> * the node id and handle multiple nodes spanning a single
> @@ -810,15 +811,14 @@ void memory_block_add_nid(struct memory_block *mem, int nid,
> mem->zone = early_node_zone_for_memory_block(mem, nid);
> else
> mem->zone = NULL;
> + /*
> + * If this memory block spans multiple nodes, we only indicate
> + * the last processed node. If we span multiple nodes (not applicable
> + * to hotplugged memory), zone == NULL will prohibit memory offlining
> + * and consequently unplug.
> + */
> + mem->nid = nid;
> }
> -
> - /*
> - * If this memory block spans multiple nodes, we only indicate
> - * the last processed node. If we span multiple nodes (not applicable
> - * to hotplugged memory), zone == NULL will prohibit memory offlining
> - * and consequently unplug.
> - */
> - mem->nid = nid;
I'll note that this change is not required, but also doesn't hurt.
Thanks Hannes!
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-07-04 7:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-04 6:34 [PATCHv3 0/3] mm/memory_hotplug: fixup crash during uevent handling Hannes Reinecke
2025-07-04 6:34 ` [PATCH 1/3] drivers/base/memory: add node id parameter to add_memory_block() Hannes Reinecke
2025-07-04 6:34 ` [PATCH 2/3] mm/memory_hotplug: activate node before adding new memory blocks Hannes Reinecke
2025-07-04 8:25 ` Oscar Salvador
2025-07-04 10:29 ` Donet Tom
2025-07-04 6:34 ` [PATCH 3/3] drivers/base: move memory_block_add_nid() into the caller Hannes Reinecke
2025-07-04 7:48 ` David Hildenbrand [this message]
2025-07-04 8:28 ` Oscar Salvador
2025-07-04 10:30 ` Donet Tom
-- strict thread matches above, loose matches on Subject: below --
2025-07-29 6:46 [PATCHv4 0/3] mm/memory_hotplug: fixup crash during uevent handling Hannes Reinecke
2025-07-29 6:46 ` [PATCH 3/3] drivers/base: move memory_block_add_nid() into the caller Hannes Reinecke
2025-07-02 7:39 [PATCHv2 0/3] mm/memory_hotplug: fixup crash during uevent handling Hannes Reinecke
2025-07-02 7:39 ` [PATCH 3/3] drivers/base: move memory_block_add_nid() into the caller Hannes Reinecke
2025-07-03 18:51 ` David Hildenbrand
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=b24a53b3-86e4-461d-834d-46780c454504@redhat.com \
--to=david@redhat.com \
--cc=hare@kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).