Re: [PATCH 1/3] sched/topology: Allow archs to populate distance map
From: Srikar Dronamraju <hidden>
Date: 2021-05-21 02:38:46
Also in:
lkml
* Peter Zijlstra [off-list ref] [2021-05-20 20:56:31]:
On Thu, May 20, 2021 at 09:14:25PM +0530, Srikar Dronamraju wrote:quoted
Currently scheduler populates the distance map by looking at distance of each node from all other nodes. This should work for most architectures and platforms. However there are some architectures like POWER that may not expose the distance of nodes that are not yet onlined because those resources are not yet allocated to the OS instance. Such architectures have other means to provide valid distance data for the current platform. For example distance info from numactl from a fully populated 8 node system at boot may look like this. node distances: node 0 1 2 3 4 5 6 7 0: 10 20 40 40 40 40 40 40 1: 20 10 40 40 40 40 40 40 2: 40 40 10 20 40 40 40 40 3: 40 40 20 10 40 40 40 40 4: 40 40 40 40 10 20 40 40 5: 40 40 40 40 20 10 40 40 6: 40 40 40 40 40 40 10 20 7: 40 40 40 40 40 40 20 10 However the same system when only two nodes are online at boot, then the numa topology will look like node distances: node 0 1 0: 10 20 1: 20 10 It may be implementation dependent on what node_distance(0,3) where node 0 is online and node 3 is offline. In POWER case, it returns LOCAL_DISTANCE(10). Here at boot the scheduler would assume that the max distance between nodes is 20. However that would not be true. When Nodes are onlined and CPUs from those nodes are hotplugged, the max node distance would be 40. To handle such scenarios, let scheduler allow architectures to populate the distance map. Architectures that like to populate the distance map can overload arch_populate_distance_map().Why? Why can't your node_distance() DTRT? The arch interface is nr_node_ids and node_distance(), I don't see why we need something new and then replace one special use of it. By virtue of you being able to actually implement this new hook, you supposedly can actually do node_distance() right too.
Since for an offline node, arch interface code doesn't have the info. As far as I know/understand, in POWER, unless there is an active memory or CPU that's getting onlined, arch can't fetch the correct node distance. Taking the above example: node 3 is offline, then node_distance of (3,X) where X is anything other than 3, is not reliable. The moment node 3 is onlined, the node distance is reliable. This problem will not happen even on POWER if all the nodes have either memory or CPUs active at the time of boot. -- Thanks and Regards Srikar Dronamraju