HomeFreeBSD

sched_ule(4): Reduce duplicate search for load.

Description

sched_ule(4): Reduce duplicate search for load.

When sched_highest() called for some CPU group returns nothing, idle
thread calls it for the parent CPU group. But the parent CPU group
also includes the CPU group we've just searched, and unless there is
a race going on, it is unlikely we find anything new this time.

Avoid the double search in case of parent group having only two sub-
groups (the most prominent case). Instead of escalating to the parent
group run the next search over the sibling subgroup and escalate two
levels up after if that fail too. In case of more than two siblings
the difference is less significant, while searching the parent group
can result in better decision if we find several candidate CPUs.

On 2-socket 40-core Xeon system I am measuring ~25% reduction of CPU
time spent inside cpu_search_highest() in both SMT (2x20x2) and non-
SMT (2x20) cases.

MFC after: 1 month

(cherry picked from commit 2668bb2add8d11c56524ce9014b510412f8f6aa9)

Details

Provenance
mavAuthored on Aug 2 2021, 2:07 AM
Parents
rGf0278de38052: Refactor/optimize cpu_search_*().
Branches
Unknown
Tags
Unknown