Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libct/cg/v1:solution to the failure of setting rt_period and rt_runtime
As reported in issue #4094, sometimes setting rt_period_us and rt_runtime_us at the same time will fail. The reason is that in cgroupv1, these two values cannot be set atomically. When we set a new rt_period_us, the kernel will determine whether the current configuration of new_limit1 = old_quota/new_period exceeds the limit. If it exceeds the limit, an error will be reported. Maybe it is reasonable to set rt_runtime_us first. new_limit2 = new_quota/old_period. for example: The original state of cgv1 is rt_period_us: 10000 rt_runtime_us: 5000 The user wants to change it to rt_period_us: 1000 rt_runtime_us:300. The new rt_runtime_us should be set first. In the opposite case, if rt_runtime_us is set first, new_limit2 may still exceed the limit, but new_limit1 will be valid. for example: The original state of cgv1 is rt_period_us: 1000 rt_runtime_us: 500 The user wants to change it to rt_period_us: 10000 rt_runtime_us:3000. The new rt_period_us should be set first. Therefore, new_limit1 and new_limit2 should be calculated in advance, and the smaller corresponding setting order should be selected to set rt_period_us and rt_runtime_us. Signed-off-by: ls-ggg <[email protected]>
- Loading branch information