Rebalancing
What
This PR adds two variations of CFS that support rebalancing threads among CPUs in a container.
-
CFSSimpleStealing: Whenever a CPU becomes idle, it steals (about) half of the run queue of another CPU, chosen at random, by weight. -
CFSLatencyRebalancing: Every CPU tries to balance out "load" everyREBALANCING_TICKnanoseconds by stealing threads from the CPU with largest load, if necessary. The design for this is documented in the Rebalancing design doc.
Testing
Currently, there is only one test for the CFSSimpleStealing scheduler, which makes sure that the stealing works to some extent. I wasn't able to come up with other reasonable tests to make sure the schedulers behave correctly.
To really test them and, importantly, evaluate how well our design for latency-based rebalancing works, we would need to run some benchmarks, and we currently don't support enough syscalls to run any. The design doc contains some suggestions for benchmarks to use.
Edited by Andreas Ellison