Index: sys/kern/subr_smp.c =================================================================== --- sys/kern/subr_smp.c +++ sys/kern/subr_smp.c @@ -596,6 +596,22 @@ smp_rendezvous_cpus(all_cpus, setup_func, action_func, teardown_func, arg); } +static void +smp_topo_prune(struct cpu_group *node) +{ + int i; + + /* If each child has one CPU, remove the children. */ + if (node->cg_children == node->cg_count) { + node->cg_child = NULL; + node->cg_children = 0; + } + + for (i = 0; i < node->cg_children; i++) { + smp_topo_prune(&node->cg_child[i]); + } +} + static struct cpu_group group[MAXCPU * MAX_CACHE_LEVELS + 1]; struct cpu_group * @@ -642,6 +658,17 @@ top = cpu_topo(); break; } + + /* + * Collapse nonsense levels that may be created out of convenience by + * the MD layers. They cause extra work in the search functions. + */ + while (top->cg_children == 1) { + top = &top->cg_child[0]; + top->cg_parent = NULL; + } + smp_topo_prune(top); + /* * Verify the returned topology. */ @@ -653,14 +680,6 @@ top, cpusetobj_strprint(cpusetbuf, &top->cg_mask), cpusetobj_strprint(cpusetbuf2, &all_cpus)); - /* - * Collapse nonsense levels that may be created out of convenience by - * the MD layers. They cause extra work in the search functions. - */ - while (top->cg_children == 1) { - top = &top->cg_child[0]; - top->cg_parent = NULL; - } return (top); }