-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libct/cg/sd: write rounded CPU quota to cgroupfs #4639
base: main
Are you sure you want to change the base?
Conversation
8d53945
to
9640365
Compare
When CPU quota is updated, the value is converted to CPUQuotaPerSecUSec property for passing to systemd. The value can be rounded in the following cases: - The value is rounded up to the nearest 10ms. - Depending on CPU period, the value may be rounded during division. Because of this rounding, systemd and runc systemd driver may write different values to cgroupfs. In order to avoid this inconsistency, this fix makes systemd driver write the same rounded value to cgroupfs by calculating the value from systemd properties. Signed-off-by: Hironori Shiina <[email protected]>
9640365
to
bfd4ea5
Compare
/cc @rata |
Oh, this is changing the behavior of existing tests? I'm busy and it's not as trivial as I'd thought. I'd take a while to review, sorry :( I hope someone else can review meanwhile :) |
Ideally, I think what we should do is to only set those parameters via fs cgroup driver which we are not able to convert to systemd. I've been meaning to try that for the last few years but never got around to :( In this particular case though, I think we can set CpuQuota and CpuPeriod to 0 for fs manager, so it won't be set. The only thing we need to make sure of is systemd actually sets quota and period. From a cursory look it looks like One alternative way is to round up the value, using the same rules as in systemd. This is essentially what your patch does, but in a somewhat complicated way. Oh well, you actually use the conversion which is performed by (Will take a deeper look later). |
One other thing is, we are in the process of splitting libcontainer/cgroups into a separate repo (see #4618), meaning most probably you'll have to open two PRs. |
This needs to be done in https://github.com/opencontainers/cgroups now. |
Ask a question, once #4638 merged, and this one has done in cgroups repo in the future, how to backport to |
Yeah, obviously a cherry-pick won't work. I understand it's not convenient, and I hope/anticipate we won't have a lot of such backports. |
I have posted opencontainers/cgroups#4. |
The only thing that bugs me is tests now depend on whether systemd is on. Guess we can just input rounded values, and add a separate test for rounding, which only runs for systemd drivers. |
When CPU quota is updated, the value is converted to CPUQuotaPerSecUSec property for passing to systemd. The value can be rounded in the following cases:
Because of this rounding, systemd and runc systemd driver may write different values to cgroupfs. In order to avoid this inconsistency, this fix makes systemd driver write the same rounded value to cgroupfs by calculating the value from systemd properties.
Fixes #4622