This fix allows the machine hierarchy to be expanded in case it needs to handle more threads. It adds a resize function to accomplish this.
But I thought that the machine hierarchy information represented the physical properties of the machine (cpus, cores, sockets, etc.). How does oversubscription factor into this? And how does that affect the number of levels?
It does represent the machine hierarchy, when there is no oversubscription, but it is actually used as a way to map existing threads to the machine hierarchy for the purpose of performing a barrier. Adding a level when oversubscribed simply adds more tree structure for all the additional threads to communicate along. One additional level duplicates the existing hierarchy as a second child of a new root, doubling the number of threads that the barrier can handle.
Added comments to clarify
Okay; please add a comment explaining this; the current definition of maxLevels says:
and this gives no indication at all of how this might need to be set to handle oversubscription. There are a few ...
but that does not really explain what is going on.