From: Hannes Reinecke <hare@kernel.org>
To: David Hildenbrand <david@redhat.com>
Cc: Oscar Salvador <osalvador@suse.de>,
linux-mm@kvack.org, Hannes Reinecke <hare@kernel.org>
Subject: [PATCH 1/2] drivers/base/memory: add node id parameter to add_memory_block()
Date: Tue, 1 Jul 2025 13:41:53 +0200 [thread overview]
Message-ID: <20250701114155.16452-2-hare@kernel.org> (raw)
In-Reply-To: <20250701114155.16452-1-hare@kernel.org>
Add a 'nid' parameter to add_memory_block() to initialize the memory
block with the correct node id.
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
drivers/base/memory.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index ed3e69dc785c..2b951e5f8a27 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -822,7 +822,7 @@ void memory_block_add_nid(struct memory_block *mem, int nid,
}
#endif
-static int add_memory_block(unsigned long block_id, unsigned long state,
+static int add_memory_block(unsigned long block_id, int nid, unsigned long state,
struct vmem_altmap *altmap,
struct memory_group *group)
{
@@ -840,7 +840,7 @@ static int add_memory_block(unsigned long block_id, unsigned long state,
mem->start_section_nr = block_id * sections_per_block;
mem->state = state;
- mem->nid = NUMA_NO_NODE;
+ mem->nid = nid;
mem->altmap = altmap;
INIT_LIST_HEAD(&mem->group_next);
@@ -867,13 +867,6 @@ static int add_memory_block(unsigned long block_id, unsigned long state,
return 0;
}
-static int add_hotplug_memory_block(unsigned long block_id,
- struct vmem_altmap *altmap,
- struct memory_group *group)
-{
- return add_memory_block(block_id, MEM_OFFLINE, altmap, group);
-}
-
static void remove_memory_block(struct memory_block *memory)
{
if (WARN_ON_ONCE(memory->dev.bus != &memory_subsys))
@@ -913,7 +906,7 @@ int create_memory_block_devices(unsigned long start, unsigned long size,
return -EINVAL;
for (block_id = start_block_id; block_id != end_block_id; block_id++) {
- ret = add_hotplug_memory_block(block_id, altmap, group);
+ ret = add_memory_block(block_id, NUMA_NO_NODE, MEM_OFFLINE, altmap, group);
if (ret)
break;
}
@@ -1018,7 +1011,7 @@ void __init memory_dev_init(void)
continue;
block_id = memory_block_id(nr);
- ret = add_memory_block(block_id, MEM_ONLINE, NULL, NULL);
+ ret = add_memory_block(block_id, NUMA_NO_NODE, MEM_ONLINE, NULL, NULL);
if (ret) {
panic("%s() failed to add memory block: %d\n",
__func__, ret);
--
2.43.0
next prev parent reply other threads:[~2025-07-01 11:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 11:41 [PATCH 0/2] mm/memory_hotplug: fixup crash during uevent handling Hannes Reinecke
2025-07-01 11:41 ` Hannes Reinecke [this message]
2025-07-01 11:55 ` [PATCH 1/2] drivers/base/memory: add node id parameter to add_memory_block() David Hildenbrand
2025-07-01 13:57 ` Oscar Salvador
2025-07-01 11:41 ` [PATCH 2/2] mm/memory_hotplug: activate node before adding new memory blocks Hannes Reinecke
2025-07-01 12:09 ` David Hildenbrand
2025-07-01 12:18 ` Hannes Reinecke
2025-07-01 14:02 ` Oscar Salvador
2025-07-01 18:52 ` Oscar Salvador
2025-07-01 18:55 ` Oscar Salvador
2025-07-01 19:23 ` David Hildenbrand
2025-07-02 5:24 ` Oscar Salvador
2025-07-02 6:25 ` Donet Tom
2025-07-02 6:36 ` David Hildenbrand
2025-07-02 7:52 ` Hannes Reinecke
2025-07-01 11:53 ` [PATCH 0/2] mm/memory_hotplug: fixup crash during uevent handling 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=20250701114155.16452-2-hare@kernel.org \
--to=hare@kernel.org \
--cc=david@redhat.com \
--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).