Re: [PATCH 2/6] mm: handle uninitialized numa nodes gracefully

Wei Yang
2022-02-03T00:21:20Z

On Tue, Feb 01, 2022 at 10:54:37AM +0100, Michal Hocko wrote:
>On Tue 01-02-22 02:41:19, Wei Yang wrote:
>> On Thu, Jan 27, 2022 at 03:47:40PM +0100, Michal Hocko wrote:
>> [...]
>> >> > + /*
>> >> > + * not marking this node online because we do not want to
>> >> > + * confuse userspace by sysfs files/directories for node
>> >> > + * without any memory attached to it (see topology_init)
>> >> > + * The pgdat will get fully initialized when a memory is
>> >> > + * hotpluged into it by hotadd_init_pgdat
>> >> > + */
>>
>> Hmm... which following step would mark the node online? On x86, the node is
>> onlined in alloc_node_date(). This is not onlined here.
>
>The comment tries to explain that this happens during the memory
>hotplug. Or maybe I have missed your question?
>

I am not sure for others, while the comment confused me a little.

Currently in kernel, there are two situations for node online:

* during memory hotplug
* during sys-init

For memory hotplug, we allocate pgdat and online node. And current hot-add
process has already put them in two steps:

1. __try_online_node()
2. node_set_online()

So emphasize "not online" node here, confuse me a little. It is a natural
thing to not online node until it has memory.

But from another point of view, the comment here is reasonable. During
sys-init, we online node at the same time when creating pgdat. And even for
memory-less node on x86, we online them too.

Well, this is all about the comment. I have tried to grab may head but not
come up with a better idea.

Or maybe this is just my personal feeling, don't bother if no-one else feel
like this.

>[...]
>--
>Michal Hocko
>SUSE Labs

--
Wei Yang
Help you, Help me