Re: [PATCH v3 1/3] driver/base: Optimize memory block registration to reduce boot time
From: Oscar Salvador
Date: Mon May 05 2025 - 03:29:07 EST
On Mon, May 05, 2025 at 09:16:48AM +0200, David Hildenbrand wrote:
> memory hotplug code never calls register_one_node(), unless I am missing
> something.
>
> During add_memory_resource(), we call __try_online_node(nid, false), meaning
> we skip register_one_node().
>
> The only caller of __try_online_node(nid, true) is try_online_node(), called
> from CPU hotplug code, and I *guess* that is not required.
Well, I guess this is because we need to link the cpus to the node.
register_one_node() has two jobs: 1) register cpus belonging to the node
and 2) register memory-blocks belonging to the node (if any).
> I think the reason is simple: memory hotplug onlines the node before it adds
> any memory. So, there is no memory yet, consequently nothing to walk /
> register.
>
> This whole code could deserve some cleanups. In particular, I am not sure if
> __try_online_node() must ever call register_one_node().
As stated, we need to call in, but maybe we can decouple it somehow (cpu
and memory).
--
Oscar Salvador
SUSE Labs