Improve scheduler performance

Improve scheduler performance by flattening nonsensical topology layers
(layers with only one child don't serve any purpose).

This is especially relevant on non-AMD Zen systems after r322776.  On my
dual core Intel laptop, this brings the kern.sched.topology_spec table down
from three levels to two.

Submitted by:	jeff
Reviewed by:	attilio
Sponsored by:	Dell EMC Isilon
This commit is contained in:
cem 2017-08-27 05:14:48 +00:00
parent 55d345402c
commit 7d770137dd

View File

@ -630,6 +630,15 @@ smp_topo(void)
panic("Built bad topology at %p. CPU mask (%s) != (%s)",
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);
}