I've been trying to understand how the Completely Fair Scheduler in the Linux kernel does CPU bandwidth control.
After many readings, I still cannot understand how the CFS allows for each cgroup to define its own CFS period and how that ties in to the
kernel.sched_cfs_bandwidth_slice_us sysctl setting.
Example A: On a single CPU machine and there are two cgroups with different CFS periods defined. The quotas of each cgroup represent 50% of CPU time, totalling 100%.
cgroup-A: cpu.cfs_period_us=100ms cpu.cfs_quota_us=50ms cgroup-B: cpu.cfs_period_us=1000ms cpu.cfs_quota_us=500ms
If each cgroup has a single process running, how are these processes scheduled given the CFS period (assuming both processes constantly require CPU time)?
Example B: What happens when cgroup-B have a higher quota than what's actually physically possible to fulfill, ie. cgroup-B set a 90% of the CPU time, and cgroup-A continues to set a quota to be 50% of the CPU time.
cgroup-A: cpu.cfs_period_us=100ms cpu.cfs_quota_us=50ms cgroup-B: cpu.cfs_period_us=1000ms cpu.cfs_quota_us=900ms
How would CFS schedule the processes in this case when the quota is oversubscribed?