On 03.02.22 08:23, Mike Rapoport wrote: > On Thu, Feb 03, 2022 at 12:21:16AM +0000, Wei Yang wrote: >> 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. > > I shuffled the words a bit, maybe this sounds better not only to me :) > > /* > * We do not want to confuse userspace by sysfs files/directories for node > * without any memory attached to it, so this node is not marked as > * N_MEMORY and not marked online so that topology_init() won't create > * sysfs hierarchy for this node. The pgdat will get fully initialized by > * hotadd_init_pgdat() when memory is hotpluged into this node > */ > Note that the topology_init() part might change soon [1] so maybe we want to rephrase that to "so that no sysfs hierarchy will be created via register_one_node() for this node." right away. or (because there is also /sys/devices/system/node/online ) "so that the node won't be indicated as online to user space, for example, via register_one_node()." [1] https://lkml.kernel.org/r/20220128151540.164759-1-david@xxxxxxxxxx -- Thanks, David / dhildenb