]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sched_ule(4): Improve long-term load balancer.
authorAlexander Motin <mav@FreeBSD.org>
Tue, 21 Sep 2021 22:14:22 +0000 (18:14 -0400)
committerAlexander Motin <mav@FreeBSD.org>
Tue, 21 Sep 2021 22:19:20 +0000 (18:19 -0400)
commite745d729be60a47b49eb19c02a6864a747fb2744
tree6b96f4d15831fa5d704a5a70d98134c2960df974
parenta342ecd326ee9e021b0a4d6dc8aca1a297c606f8
sched_ule(4): Improve long-term load balancer.

Before this change long-term load balancer was unable to migrate
running threads, only ones waiting on run queues.  But with growing
number of CPU cores it is quite typical now for system to not have
many waiting threads.  But same time if due to some coincidence two
long-running CPU-bound threads ended up sharing same physical CPU
core, they could suffer from the SMT penalty indefinitely, and the
load balancer couldn't help.

Improve that by teaching the load balancer to hint running threads
to migrate by marking them with TDF_NEEDRESCHED and new TDF_PICKCPU
flag, making sched_pickcpu() to search for better CPU later, when
it is convenient.

Fix CPU search logic when balancing to limit round-robin migrations
in case of almost equal load to the group of physical cores.  The
previous code bounced threads across all the system, that should be
pretty bad for caches and NUMA affinity, while additional fairness
was almost invisible, diminishing with number of cores in the group.

MFC after: 1 month
sys/kern/sched_ule.c