[PATCH 0/2] sched/fair: expose cpu.max.runtime for credit injection

From: Fernand Sieber

Date: Mon May 25 2026 - 15:36:53 EST


This series adds a cpu.max.runtime cgroup v2 interface that allows
userspace to set the CFS bandwidth controller's runtime directly,
enabling CPU credit injection.

An orchestrator writes a runtime budget which the cgroup consumes
naturally through the existing bandwidth enforcement mechanism. Each
period, the task consumes runtime and the refill restores only quota
(capped at quota + burst), so the injected credits drain until runtime
falls below the cap, after which the cgroup returns to its steady-state
quota allocation.

The series also relaxes the burst validation: burst is no longer
required to be <= quota, only that burst + quota does not overflow.
This allows configuring burst > quota so that the runtime cap can reach
up to one full period, enabling 100% utilization while credits last.

A selftest (test_cpucg_max_runtime) validates the credit injection
mechanism by configuring a cgroup with minimal quota but large burst,
injecting credits via cpu.max.runtime, and verifying that the resulting
CPU usage matches the injected budget.

Patch 1 adds the core interface and selftest.
Patch 2 adds sched_ext integration: an ops callback for BPF scheduler
notification when runtime credits are injected.

Fernand Sieber (2):
sched/fair: expose cpu.max.runtime to set bandwidth runtime directly
sched/ext: add cgroup_set_runtime ops callback

include/linux/sched/ext.h | 1 +
kernel/sched/core.c | 46 ++++++++++++++++-
kernel/sched/ext.c | 17 +++++++
kernel/sched/ext.h | 2 +
kernel/sched/ext_internal.h | 12 +++++
tools/testing/selftests/cgroup/test_cpu.c | 62 +++++++++++++++++++++++
6 files changed, 138 insertions(+), 2 deletions(-)

--
2.47.3




Amazon Development Centre (South Africa) (Proprietary) Limited
29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa
Registration Number: 2004 / 034463 / 07