Skip to content

Commit d01d10d

Browse files
committed
hwloc_distrib: better handle non-normal roots
We used NUMA Node's parent, but there may also be a Memcache above. Just walk up until we find a normal object, it will also work with I/O and Misc. At least it won't fail as before. Signed-off-by: Brice Goglin <[email protected]>
1 parent 9922a2a commit d01d10d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/hwloc/helper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ hwloc_distrib(hwloc_topology_t topology,
872872
unsigned chunk, weight;
873873
hwloc_obj_t root = roots[flags & HWLOC_DISTRIB_FLAG_REVERSE ? n_roots-1-i : i];
874874
hwloc_cpuset_t cpuset = root->cpuset;
875-
if (root->type == HWLOC_OBJ_NUMANODE)
876-
/* NUMANodes have same cpuset as their parent, but we need normal objects below */
875+
while (!hwloc_obj_type_is_normal(root->type))
876+
/* If memory/io/misc, walk up to normal parent */
877877
root = root->parent;
878878
weight = (unsigned) hwloc_bitmap_weight(cpuset);
879879
if (!weight)

0 commit comments

Comments
 (0)