From: Hannes Reinecke <hare@suse.de>
To: David Hildenbrand <david@redhat.com>, Hannes Reinecke <hare@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>, linux-mm@kvack.org
Subject: Re: [PATCH 2/3] mm/memory_hotplug: activate node before adding new memory blocks
Date: Thu, 3 Jul 2025 13:54:21 +0200 [thread overview]
Message-ID: <dce83ad5-57f5-4c5f-a394-cf67b285815d@suse.de> (raw)
In-Reply-To: <3a790038-cd63-4c4f-af05-e98aecb56bb8@redhat.com>
On 7/3/25 13:29, David Hildenbrand wrote:
> On 02.07.25 09:39, Hannes Reinecke wrote:
>> The sysfs attributes for memory blocks require the node ID to be
>> set and initialized, so move the node activation before adding
>> new memory blocks. This also has the nice side effect that the
>> BUG_ON() can be converted into a WARN_ON() as we now can handle
>> registration errors.
>>
>> Fixes: b9ff036082cd ("mm/memory_hotplug.c: make add_memory_resource
>> use __try_online_node")
>
> We should CC stable.
>
Yeah, that's probably not a bad idea.
>> Signed-off-by: Hannes Reinecke <hare@kernel.org>
>> ---
>> drivers/base/memory.c | 19 +++++++++----------
>> include/linux/memory.h | 2 +-
>> mm/memory_hotplug.c | 32 +++++++++++++++++---------------
>> 3 files changed, 27 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
>> index 2b951e5f8a27..d24a90e0ea96 100644
>> --- a/drivers/base/memory.c
>> +++ b/drivers/base/memory.c
>> @@ -810,15 +810,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 would not perform this change in this patch. It's not required here,
> right? We're simply re-setting the nid. Patch #3 can clean that up.
>
Well. You tell me :-)
Thing is, we already have a 'nid' value as argument to
add_memory_resource().
So I would _think_ that it should be the same value which we end up
with in memory_block_add_nid().
But if that's the case we could've set it during memblock
initialization, which we don't. So I thought there must be a reason
for that, and the only reason I could think of is that 'nid' is not
known during memblock initialization, ie that the 'nid' value in
add_memory_resource() is a different 'nid' value from the one used in
memory_block_add_nid().
If so then we cannot leave out.
If not, then indeed, we can leave it out.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
next prev parent reply other threads:[~2025-07-03 11:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 7:39 [PATCHv2 0/3] mm/memory_hotplug: fixup crash during uevent handling Hannes Reinecke
2025-07-02 7:39 ` [PATCH 1/3] drivers/base/memory: add node id parameter to add_memory_block() Hannes Reinecke
2025-07-03 11:59 ` Donet Tom
2025-07-02 7:39 ` [PATCH 2/3] mm/memory_hotplug: activate node before adding new memory blocks Hannes Reinecke
2025-07-03 11:29 ` David Hildenbrand
2025-07-03 11:54 ` Hannes Reinecke [this message]
2025-07-03 18:49 ` David Hildenbrand
2025-07-04 6:09 ` 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
-- strict thread matches above, loose matches on Subject: below --
2025-07-04 6:34 [PATCHv3 0/3] mm/memory_hotplug: fixup crash during uevent handling 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-29 6:46 [PATCHv4 0/3] mm/memory_hotplug: fixup crash during uevent handling Hannes Reinecke
2025-07-29 6:46 ` [PATCH 2/3] mm/memory_hotplug: activate node before adding new memory blocks Hannes Reinecke
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=dce83ad5-57f5-4c5f-a394-cf67b285815d@suse.de \
--to=hare@suse.de \
--cc=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).