topology-aware: rework building the topology pool tree. #477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR reworks and simplifies how the tree of pools is built in the topology-aware policy, using the detected hardware topology.
We now build the tree by walking the topology from sockets to dies to NUMA nodes closest to dies. We assign local CPU and memory close these CPUs in tandem to each pool as we build the tree. Once the tree is built, we go through each pool node again and assign CPUless NUMA nodes to the same nodes where their closest NUMA nodes with CPUs are assigned to.
Like earlier, the tree is constructed to be minimal. If the system has a single socket, we omit the virtual root and use the sole socket as the root pool to represent the whole system (since it would have the same resources as its parent virtual root node). If a socket has a single die, we omit that die from the subtree under the socket (since it would have the same resources as its parent socket node). If a die has a single close NUMA node, we omit the tree node that would represent CPUs close to a die-local NUMA node (since it would have the same resources as its parent die or socket node).