sched: Async unthrottling for cfs bandwidth
authorJosh Don <joshdon@google.com>
Thu, 17 Nov 2022 00:54:18 +0000 (16:54 -0800)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 27 Dec 2022 11:52:09 +0000 (12:52 +0100)
commit8ad075c2eb1f6b4b33436144ea1ef2619f3b6398
tree2042529107850a120489d67b80e7fdcf81f7aab2
parent9a5322db46332a4ce42369e86f031b5e963d841c
sched: Async unthrottling for cfs bandwidth

CFS bandwidth currently distributes new runtime and unthrottles cfs_rq's
inline in an hrtimer callback. Runtime distribution is a per-cpu
operation, and unthrottling is a per-cgroup operation, since a tg walk
is required. On machines with a large number of cpus and large cgroup
hierarchies, this cpus*cgroups work can be too much to do in a single
hrtimer callback: since IRQ are disabled, hard lockups may easily occur.
Specifically, we've found this scalability issue on configurations with
256 cpus, O(1000) cgroups in the hierarchy being throttled, and high
memory bandwidth usage.

To fix this, we can instead unthrottle cfs_rq's asynchronously via a
CSD. Each cpu is responsible for unthrottling itself, thus sharding the
total work more fairly across the system, and avoiding hard lockups.

Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20221117005418.3499691-1-joshdon@google.com
kernel/sched/fair.c
kernel/sched/sched.h