A burst configured while a cgroup has unlimited CPU bandwidth can prevent a later finite quota from being installed. On cgroup v2, for instance:
# echo 100000000 > cpu.max.burst # echo "50000 100000" > cpu.max sh: write error: Invalid argument The quota stays unlimited because tg_set_bandwidth() validates the existing burst against the new quota, and the only recovery is for userspace to know that it must clear the burst before retrying the quota update. cgroup v1 has the same problem through cpu.cfs_quota_us. Patch 1 resets the existing burst to zero when a valid finite quota is written that the burst is incompatible with, while preserving it when it remains compatible or when the new quota is unlimited. This lets a quota update take effect regardless of the order in which userspace writes the two files, and still allows a burst to be staged before bandwidth control is enabled. A cgroup v2 selftest is added for the behavior. Patch 2 documents the reset behavior in the cgroup v1 and v2 CPU bandwidth documentation. Zhe Liu (2): sched/fair: Reset incompatible burst on quota change Documentation: describe burst reset on quota changes Documentation/admin-guide/cgroup-v2.rst | 5 +- Documentation/scheduler/sched-bwc.rst | 14 ++--- kernel/sched/core.c | 17 ++++++- tools/testing/selftests/cgroup/test_cpu.c | 62 +++++++++++++++++++++++ 4 files changed, 90 insertions(+), 8 deletions(-) -- 2.25.1

