Re: [PATCH 1/6] sched/topology: introduce for_each_numa_hop_node() / sched_numa_hop_node()
From: Tejun Heo
Date: Wed Dec 18 2024 - 11:05:04 EST
Hello,
On Wed, Dec 18, 2024 at 11:23:40AM +0100, Andrea Righi wrote:
...
> > So, this would work but given that there is nothing dynamic about this
> > ordering, would it make more sense to build the ordering and store it
> > per-node? Then, the iteration just becomes walking that array.
>
> I've also considered doing that. I don't know if it'd work with offline
> nodes, but maybe we can just check node_online(node) at each iteration and
> skip those that are not online.
Yeah, there can be e.g. for_each_possible_node_by_dist() where nodes with
unknown distances (offline ones?) are put at the end and then there's also
for_each_online_node_by_dist() which filters out offline ones, and the
ordering can be updated from a CPU hotplug callback. The ordering can be
probably put in an rcu protected array? I'm not sure what's the
synchronization convention around node on/offlining. Is that protected
together with CPU on/offlining?
Given that there usually aren't that many nodes, the current implementation
is probably fine too, so please feel free to ignore this suggestion for now
too.
Thanks.
--
tejun